Owner (User)
Group
Public (Other)
Permission Code
Linux File Permissions Explained
In Unix and Linux systems (like Ubuntu, CentOS, or macOS), every file and directory has a set of permissions that determine who can read, write, or execute it. The Chmod command is used to change these permissions.
Understanding the Numbers (Octal)
Permissions are represented by a 3-digit code (e.g., 755). Each digit corresponds to a user group:
- First Digit: Owner (The user who created the file).
- Second Digit: Group (Other users in the file's group).
- Third Digit: Others (The public/world).
Common Permission Cheat Sheet
755 (Standard Folder)
Owner: Read, Write, Execute
Group/Other: Read, Execute
Use For: Web directories, public scripts.
644 (Standard File)
Owner: Read, Write
Group/Other: Read Only
Use For: HTML pages, images, text files.
400 (Secure Key)
Owner: Read Only
Group/Other: No Access
Use For: SSH Private Keys (.pem), config files with passwords.
777 (DANGER)
Everyone: Full Access
Never use this on a public web server. It allows anyone to delete or modify your files.
How to Calculator Manually
Simply sum the values for each permission:
- Read (r): 4
- Write (w): 2
- Execute (x): 1
Example: Read + Write = 4 + 2 = 6.