Home/Tech/Chmod
Chmod Calculator
Owner
Group
Public
Understanding Linux Permissions
In Linux/Unix systems, file permissions are managed using a 3-digit octal code (e.g., 755) or symbolic notation (e.g., rwxr-xr-x). Each digit represents the permissions for a specific group: Owner, Group, and Public (Others).
The values are calculated by adding:
• Read (r) = 4
• Write (w) = 2
• Execute (x) = 1
⚠️ Common Mistake: Using 777 for Everything
Setting permissions to 777 (rwxrwxrwx) is a HUGE security risk. It gives everyone full control. For web files, use 644 for files and 755 for directories. Never use 777 in production unless you know exactly why.
Common Permission Codes
- 777 (rwxrwxrwx): No restrictions. Dangerous.
- 755 (rwxr-xr-x): Owner has full access; others can only read/execute. Standard for scripts/directories.
- 644 (rw-r--r--): Owner can read/write; others can only read. Standard for text/config files.
- 600 (rw-------): Only owner can read/write. Use for SSH keys and sensitive data.
- 400 (r--------): Read-only for owner. Good for protecting critical backups.
Frequently Asked Questions
What is chmod 777?
Chmod 777 gives full read, write, and execute permissions to everyone (Owner, Group, and Public). It is generally considered a security risk and should be used with extreme caution.
What is the difference between 755 and 644?
755 (rwxr-xr-x) allows the owner to do everything, while others can only read and execute. It's common for scripts and directories. 644 (rw-r--r--) allows the owner to read/write, while others can only read. It's the standard for regular files.
How do I calculate octal permissions?
Permissions are summed up: Read = 4, Write = 2, Execute = 1. For example, Read+Write = 4+2 = 6. You do this for Owner, Group, and Public to get the 3-digit code (e.g., 644).
What does 'chmod +x' do?
'chmod +x filename' adds execute permission to the file for all users (Owner, Group, and Public). It's equivalent to adding 1 to each digit in the octal code where execute was missing.