$ ls -l /usr/bin/sudo -rwsr-xr-x 1 root root 136808 Jul 4 2017 /usr/bin/sudo
sudo is runnable by any user, and any user who runs
sudo will have root as the effective user ID of the process because the set-user-id bit of
/usr/bin/sudo is set.
the most visible difference between sudo and su is that sudo requires the user's password and su requires root's password.
Which user's password does
sudoasks for? Is it the user represented by the real user ID of the process?
If yes, doesn't any user can gain the superuser privilege by running
sudoand then providing their own password? Can Linux restrict that on some users?
Is it correct that
sudoasks for the password after
execve()starts to execute
Since the euid of the process has been changed to root (because the set-user-id bit of /usr/bin/sudo is set), what is the point of sudo asking for password later?
I have read https://unix.stackexchange.com/a/80350/674, but it doesn't answer the questions above.