LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What are the special permissions SUID, SGID, and Sticky Bit?

Three extra bits sitting in a fourth, leading octal digit: SUID (4) = "run this program as its owner", SGID (2) = "run as its group, and on a directory, give new files that group", Sticky (1) = "in this shared directory, only a file's owner may delete it".

The 4th octal digit fans out to SUID=4 (run as owner), SGID=2 (run as group / inherit dir group), Sticky=1 (only owner deletes in a shared dir).

* The three special bits and what each one does. *

These exist to solve cases the plain rwx model can't. SUID lets an unprivileged user run a root-owned program with root's identity for the duration — that's how passwd lets you edit your line in root-only /etc/shadow without being root. SGID on a directory makes every file created inside inherit the directory's group, the standard trick for shared team folders so everyone can read each other's work. Sticky turns a world-writable directory like /tmp from a free-for-all (anyone with w could delete anyone's files) into "create freely, but delete only your own".

They occupy the same x column in ls -l, which is why they show as letters: lowercase s/t when the underlying execute bit is also set, uppercase S/T when it isn't (a hint that the bit may be misconfigured).

Permission Octal Symbol Effect on Files Effect on Directories
SUID 4 s (in user x) Execute as file owner -
SGID 2 s (in group x) Execute as file group New files inherit group
Sticky 1 t (in other x) - Only owner can delete files

SUID (Set User ID):

  • File runs with owner's permissions, not executor's
  • Example: /usr/bin/passwd (runs as root to modify /etc/shadow)
chmod u+s file    # or chmod 4755 file
-rwsr-xr-x       # Note lowercase 's'

SGID (Set Group ID):

  • File: runs with group's permissions
  • Directory: new files inherit directory's group
chmod g+s dir     # or chmod 2755 dir
drwxr-sr-x       # Note lowercase 's'

Sticky Bit:

  • Directory: only file owner (or root) can delete/rename files
  • Classic example: /tmp - everyone can write, but can't delete others' files
chmod +t dir      # or chmod 1755 dir
drwxrwxrwt       # Note lowercase 't'

Mnemonic: SUID=4, SGID=2, Sticky=1 (same as rwx pattern!)

Go deeper:

From Quiz: LIOS / User Management and Permissions | Updated: Jul 14, 2026