setuid (s) | setgid (s) | sticky (t) | |
---|---|---|---|
Directory | ignored | New subfiles inherit group | Only owner of subfile can (re)move it* |
File | Executes as file owner | Executes as group | ignored |
Sticky bit can be set with chmod
as the first of four digits, or using {+,-}s
(for setuid/setgid) and {+,-}t
(for sticky). For example, to enable setuid,
chmod u+s $FILE # Add setuid to a file
chmod 4755 $FILE # Possible permissions of /bin/ping
Permissions displayed as an {s,S,t,T}
in the third character of each permission section. For example,
-rwsr-xr-x 1 root root 68520 Aug 29 01:25 /bin/ping*
- Since the setuid/setgid/sticky bit character is written in the same place as the execute bit, lowercase indicates execute bit is set and uppercase means execute bit is not set.
* Root and owner of the directory can also (re)move subfiles. Commonly used in /tmp