Chmod Calculator
🎨 Visual Permission Builder
👤 Owner
👥 Group
🌍 Others
⚡ Common Permissions
Owner: full control. Others: read & execute. Common for scripts.
Owner: read & write. Others: read only. Standard for web files.
Full access for everyone. Security risk! Avoid in production.
Owner only. Maximum privacy. Good for private scripts.
Owner read/write only. Perfect for private config files.
Read-only for everyone. Prevents accidental modifications.
🧮 How Permissions Are Calculated
Binary Representation
Example: 755
All Combinations
Chmod Calculator - Unix/Linux File Permissions Calculator
🔐 Calculate and convert Unix/Linux file permissions between numeric (777, 644) and symbolic (rwxr-xr-x) formats. Visual chmod calculator for understanding file access control.
What is Chmod?
Chmod (change mode) is a Unix/Linux command used to change file and directory permissions. It controls who can read, write, or execute files using a three-digit octal number system.
Permission Types
- Read (r / 4): View file contents or list directory contents
- Write (w / 2): Modify file contents or create/delete files in directory
- Execute (x / 1): Run file as program or access directory
User Categories
- Owner (User): File creator or assigned owner
- Group: Users belonging to the file's group
- Others (World): All other users on the system
How to Calculate Permissions
Each digit is calculated by adding permission values:
- 0: No permissions (---)
- 1: Execute only (--x)
- 2: Write only (-w-)
- 3: Write + Execute (-wx) = 2+1
- 4: Read only (r--)
- 5: Read + Execute (r-x) = 4+1
- 6: Read + Write (rw-) = 4+2
- 7: Full permissions (rwx) = 4+2+1
Common Permission Modes
- 755 (rwxr-xr-x): Owner full access, others read/execute. Standard for executables and scripts.
- 644 (rw-r--r--): Owner read/write, others read only. Default for web files (HTML, CSS, images).
- 600 (rw-------): Owner read/write only. Secure for private config files, SSH keys.
- 777 (rwxrwxrwx): Full access for everyone. DANGEROUS - avoid in production!
- 700 (rwx------): Owner full access only. Maximum privacy for scripts and directories.
- 444 (r--r--r--): Read-only for everyone. Prevents accidental modifications.
Directory vs File Permissions
Permissions work differently for directories:
- Read (r): List directory contents (ls)
- Write (w): Create/delete files in directory
- Execute (x): Enter directory (cd) and access files
- Note: Execute permission is required to access a directory!
Command Usage
Basic chmod syntax:
- chmod 755 file.sh - Set specific permissions
- chmod +x script.sh - Add execute permission
- chmod -w file.txt - Remove write permission
- chmod u+x,g-w file - Add execute for owner, remove write for group
- chmod -R 755 /directory - Recursive (apply to all files/subdirs)
Security Best Practices
- Never use 777: Gives full access to everyone, major security risk
- Principle of least privilege: Grant minimum permissions needed
- Web files: Usually 644 for files, 755 for directories
- Config files: 600 or 400 to prevent unauthorized reading
- SSH keys: Must be 600 or SSH will refuse to use them
- Executable scripts: 700 (private) or 755 (public)
Real-World Examples
- Web Server (Apache/Nginx): Files 644, directories 755
- WordPress: wp-config.php should be 600 or 400
- SSH Private Key: ~/.ssh/id_rsa must be 600
- Cron Jobs: Scripts should be 700 or 750
- Log Files: 640 (owner read/write, group read)
💡 Pro Tip: Use ls -l to view current permissions.
The first 10 characters show file type and permissions (e.g., -rwxr-xr-x means regular file with 755 permissions).
The first character indicates type: - (file), d (directory), l (symlink).
Comments (0)
Share your thoughts — please be polite and stay on topic.
Log in to comment