File Permission Calculator - Linux Chmod Generator
Calculate Unix/Linux file permissions visually. Generate chmod commands and understand permission modes for system administration.
Owner (u)
6
Group (g)
4
Others (o)
4
644-rw-r--r--$ chmod 644 filenameUnderstanding Linux File Permissions
In Unix and Linux systems, every file and directory has an associated set of permissions that determine who can read, write, or execute the file. These permissions are fundamental to system security and user access control.
This file permission calculator helps you visualize and calculate the correct chmod values without memorizing octal codes or symbolic notation.
The Three Permission Categories
- Owner (u): The user who owns the file, typically the creator.
- Group (g): Users belonging to the file's group.
- Others (o): Everyone else on the system.
Permission Types and Values
- Read (r) = 4: View file contents or list directory contents.
- Write (w) = 2: Modify or delete the file; create files in directory.
- Execute (x) = 1: Run file as program; access directory contents.
The octal value for each category is the sum of permissions: rwx = 4+2+1 = 7, rw- = 4+2 = 6, r-- = 4.
Common Permission Modes
- 755: Owner: rwx, Group: r-x, Others: r-x (standard for executables/directories)
- 644: Owner: rw-, Group: r--, Others: r-- (standard for files)
- 600: Owner: rw-, Group: ---, Others: --- (private files)
- 777: Everyone: rwx (dangerous, avoid in production)
- 400: Owner: r--, Group: ---, Others: --- (read-only, like SSH keys)
Using the chmod Command
The chmod command changes file permissions. Examples:
chmod 755 script.sh- Make script executablechmod 644 document.txt- Standard file permissionschmod -R 755 directory/- Recursive permission changechmod u+x file- Add execute for owner (symbolic)chmod go-w file- Remove write from group/others
Special Permission Bits
- SUID (4000): Execute as file owner (e.g., passwd command).
- SGID (2000): Execute as group owner or inherit group in directories.
- Sticky Bit (1000): Only owner can delete files in directory (e.g., /tmp).
Security Best Practices
- Never use 777 on production systems.
- Use 600 for SSH private keys.
- Web files typically use 644, directories 755.
- Use groups to share access instead of opening to others.
- Audit permissions regularly with
find / -perm -777.