Linux Permissions Cheat Sheet

This cheat sheet focuses on the most common permission sets you’ll encounter when managing Linux systems, backups, and hypervisors.

The Octal (Numeric) Reference

Each permission has a value: Read (4), Write (2), and Execute (1).

CodeMeaningTypical Use Case
777rwxrwxrwxDanger! Everyone can do everything. Avoid in production.
755rwxr-xr-xStandard for directories and executable scripts.
700rwx------Private directories or scripts only for the owner.
664rw-rw-r--Shared files where the group can also edit.
644rw-r--r--Standard for regular files (Config files, HTML).
600rw-------Sensitive files (SSH keys, backup credentials).
400r--------Read-only for owner; maximum security for keys.

Essential Ownership Commands (chown)

CommandAction
chown user fileChange the owner of a file.
chown user:group fileChange both owner and group.
chown -R user:group dirRecursive: Change owner/group for a folder and everything inside.

Essential Permission Commands (chmod)

CommandAction
chmod +x script.shMake a script executable for everyone.
chmod u+x script.shMake a script executable for the owner only.
chmod -R 755 /dataApply 755 to a directory and all its contents.
chmod 444 config.iniMake a file read-only for everyone (even the owner).

Pro-Tip: The Sticky Bit

When managing shared folders (like a common backup landing zone), you might want users to add files but prevent them from deleting each other’s work.

  • Command: chmod +t /shared_folder
  • Result: Only the file owner or root can delete or rename the files within that directory.

Leave a Reply

Your email address will not be published. Required fields are marked *