Beyond RWX: Controlling Execution and Sharing
In addition to the standard 9 permissions, Linux has three special permission bits that affect how files and directories behave. These are represented by a leading fourth digit in octal notation or by s or t in symbolic notation.
1. Set User ID (SUID)
- Octal: 4
- Symbolic:
sin the User field.
If SUID is set on an executable file, the program will run with the permissions of the file owner, regardless of which user executes it.
Crucial Example: The passwd command. It is owned by root and has SUID set. When you run passwd, the process temporarily gains root privileges to write to the protected /etc/shadow file, allowing you to change your password.
bash $ ls -l /usr/bin/passwd -rwsr-xr-x 1 root root ... /usr/bin/passwd