LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Executing an application with sudo fires up 3 new instances (https://www.linuxquestions.org/questions/slackware-14/executing-an-application-with-sudo-fires-up-3-new-instances-4175734004/)

fulalas 02-18-2024 03:25 PM

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).

Not sure what's happening here.

elsheepo 02-18-2024 06:22 PM

Quote:

Originally Posted by fulalas (Post 6484489)
Not sure what's happening here.

Me either, give this a try instead
Code:

su --command="mousepad"
or just
Code:

su -c "mousepad"
sudo is not really "good practice" in Slackware.

marav 02-18-2024 06:31 PM

Quote:

Originally Posted by elsheepo (Post 6484515)
sudo is not really "good practice" in Slackware.

From my POV, sudo is always a good practice no matter the distribution

ctrlaltca 02-19-2024 02:38 AM

From https://www.sudo.ws/docs/man/1.8.15/...#Process_model :
Code:

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.


fulalas 02-19-2024 11:53 AM

@ctrlaltca, thanks. But then how can we explain Fedora having just one instance of sudo?


All times are GMT -5. The time now is 04:49 AM.