setting effective UID/GID on linux

There are several ways to change the real or effective UID/GID of a process: –

* exec system call, when used to execute a program installed in suid (set uid) mode, changes the effective UID of the process to the effective UID of the owner of the program file. This the trick used by passwd program. Similarly, effective GID changes for the programs installed in sgid mode.

* setuid system call can be used for changing the effective UID  of the process. A process having real UID of 0 i.e. root can change the real UID as well using the same system call. Similaly, setgid can be used for setting effective and real (by root) GIDs.

Leave a comment