Explain file permissions in Linux (rwx, octal notation) and when to use sticky bit/setuid.

Medium Topic: Linux May 24, 2026

Linux file permissions have three sets: owner, group, others. Each can have: read (4), write (2), execute (1).

-rwxr-xr-- = 754
# Owner: rwx (7), Group: r-x (5), Others: r-- (4)

chmod 755 script.sh   # Standard executable
chmod 644 config.yml  # Standard config file

Special bits:

  • Sticky bit (1xxx): On directories (e.g., /tmp), only the file owner can delete their own files: chmod +t /shared
  • Setuid (4xxx): File executes with the owner’s permissions (used by /usr/bin/passwd to write /etc/shadow as root). Use with extreme caution.
← Previous What is a Load Average in Linux and... Next → What is the difference between SSH key authentication...

Practice Similar Questions

Back to Linux Topics