Executing an application with sudo fires up 3 new instances
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Executing an application with sudo fires up 3 new instances
Example:
Code:
$ sudo mousepad
Expected behavior (after inputting the correct password): 2 new processes will be fired up: sudo and mousepad
Current behavior: 3 new processes are fired up: sudo, sudo (again) and mousepad
This can also be seen on Ubuntu (live). However, not in Fedora (live) or Manjaro (live).
When sudo runs a command, it calls fork(2), sets up the execution
environment as described above, and calls the execve system call in
the child process. The main sudo process waits until the command has
completed, then passes the command's exit status to the security
policy's close function and exits. If an I/O logging plugin is
configured or if the security policy explicitly requests it, a new
pseudo-terminal (“pty”) is created and a second sudo process is used
to relay job control signals between the user's existing pty and the
new pty the command is being run in. This extra process makes it
possible to, for example, suspend and resume the command. Without it,
the command would be in what POSIX terms an “orphaned process group”
and it would not receive any job control signals. As a special case,
if the policy plugin does not define a close function and no pty is
required, sudo will execute the command directly instead of calling
fork(2) first. The sudoers policy plugin will only define a close
function when I/O logging is enabled, a pty is required, or the
pam_session or pam_setcred options are enabled. Note that pam_session
and pam_setcred are enabled by default on systems using PAM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.