Chmod Calculator
Calculate and convert between symbolic and numeric Unix file permissions using the chmod command syntax.
Calculate Your Chmod Calculator
What is chmod?
The chmod
command (change mode) is a Unix/Linux command used to change the access permissions of files and directories. It controls who can read, write, or execute a file, providing a fundamental level of security in Unix-based operating systems. Understanding chmod permissions is essential for system administrators, developers, and anyone working with Linux or Unix systems.
Permission Types
Unix file permissions are based on three types of access for three categories of users:
Permission Types
- Read (r): View file contents or list directory contents
- Write (w): Modify file contents or add/remove files in a directory
- Execute (x): Run the file as a program or enter a directory
User Categories
- Owner (u): The user who owns the file
- Group (g): Users who are members of the file's group
- Others (o): All other users on the system
Numeric (Octal) Notation
Chmod permissions can be represented using numeric (octal) notation, where each permission type is assigned a value:
Read (r)
4
Write (w)
2
Execute (x)
1
The permission value for each user category is the sum of the values for the granted permissions:
where x = owner permissions, y = group permissions, z = other permissions
Owner: 7 (4+2+1) = rwx
Group: 5 (4+0+1) = r-x
Others: 5 (4+0+1) = r-x
Owner: 6 (4+2+0) = rw-
Group: 4 (4+0+0) = r--
Others: 4 (4+0+0) = r--
Owner: 6 (4+2+0) = rw-
Group: 0 (0+0+0) = ---
Others: 0 (0+0+0) = ---
Symbolic Notation
Symbolic notation uses letters and symbols to represent users and permissions:
User Symbols:
u
= ownerg
= groupo
= othersa
= all (equivalent to ugo)
Operation Symbols:
+
= add permission-
= remove permission=
= set exact permission
Examples of symbolic notation:
chmod u+x file
Add execute permission for the ownerchmod go-w file
Remove write permission from group and otherschmod a=r file
Set read-only permission for all userschmod u=rwx,g=rx,o=r file
Set specific permissions for each user categoryCommon Permission Scenarios
Regular Files
644 (rw-r--r--)
: Owner can read and write, group and others can only read
Good for configuration files and documents that should be viewable but not editable by others.
Private Files
600 (rw-------)
: Owner can read and write, no access for anyone else
Ideal for sensitive files like SSH private keys, API credentials, and personal data.
Directories
755 (rwxr-xr-x)
: Owner can read, write, and access; group and others can read and access
Common for directories where content should be visible but not modifiable by others.
Executable Scripts
755 (rwxr-xr-x)
: Owner can read, write, and execute; group and others can read and execute
Appropriate for shell scripts and programs that need to be executed by multiple users.
Security Best Practices
Principle of Least Privilege: Give users only the permissions they need to perform their tasks, and no more.
Avoid 777 Permissions: Setting chmod 777
(full access for everyone) is rarely necessary and creates significant security risks.
Secure Sensitive Files: Use 600
or 400
for sensitive files like private keys or credentials.
Use Group Permissions: Create appropriate user groups and assign permissions accordingly rather than giving broad "others" permissions.
Frequently Asked Questions
Share This Calculator
Found this calculator helpful? Share it with your friends and colleagues!