Home > Software engineering >  Revoke parent permissions on child process
Revoke parent permissions on child process

Time:01-08

I have a context in which for testing and security reason I want to fork a process then revoke the parent's permissions on the child process.

Is there a function to break this parent/child connection when or after forking a process?

Some functions e.g. waitpid work only for child processes I want these functions to no longer work on the child process.

CodePudding user response:

So you want to make the child-processes orphaned?

Then use two forks: One to create an intermediate child process.

Then the child process does another fork for the actual child-process. The intermediate child-process (the direct child) then exits, making the new grand-child process orphaned (its new parent will become the init process, with id 1).

  • Related