From
man sudo
When sudo executes a command, the security policy specifies the execution environment for the command. Typically, the real and effective user and group and IDs are set to match those of the target user, as specified in the password database, and the group vector is initialized based on the group database (unless the -P option was specified).
Why does
sudo
change both effective and real user/group IDs to those of the target user, instead of just effective user/group IDs?Are effective user/group IDs not the only ones needed to take on the privileges of the target user?
From https://unix.stackexchange.com/a/333245/674
changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy defined in sudo.conf can use any other kind of parameters in the above list.
In order to change the privileges, are there other ways than changing the effective user/group IDs? What are they?
Thanks.
My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?