setuid
Permission
When setuid
permission is set on an executable file, a process that runs this file is granted access on the basis of the owner of the file. The access is not based on the user who is running the executable file. This special permission allows a user to access files and directories that are normally available only to the owner.
For example, the setuid
permission on the passwd
command makes it possible for users to change passwords. A passwd
command with setuid
permission would resemble the following:
-r-sr-sr-x 1 root sys 62K Jun 14 14:14 /usr/bin/passwd
This special permission presents a security risk. Some determined users can find a way to maintain the permissions that are granted to them by the setuid
process even after the process has finished executing.
Note:
The use ofsetuid
permissions with the reserved UIDs (0-100) from a program might not set the effective UID correctly. Use a shell script, or avoid using the reserved UIDs with setuid
permissions.