Tech & Digital
Chmod Calculator: Unix File Permissions (Numeric and Symbolic)
Work out Unix and Linux file permissions. On Linux, macOS and other Unix-like systems, every file and directory has permissions that control who may read, write or execute it, for three classes of user: the owner, the members of the file’s group and everyone else. The chmod command sets these permissions, and they can be written in two ways. In numeric, or octal, form, each class gets one digit made by adding read (4), write (2) and execute (1), so 7 means all three, 6 read and write, 5 read and execute and 4 read only. Common values are 755 for programs and directories, 644 for ordinary files and 600 for private files such as keys. In symbolic form, as shown by ls -l, the same permissions appear as nine characters, such as rwxr-xr-x. A fourth leading digit can add special modes: setuid (4) runs a program with its owner’s privileges, setgid (2) uses the group’s privileges or makes new files inherit a directory’s group, and the sticky bit (1) stops users deleting other people’s files in shared directories such as /tmp. Enter permissions in either form to convert them, see what each class may do and get the matching chmod command.
How to use this calculator
- Enter three or four octal digits, such as 644 or 4755.
- Or enter nine symbolic characters, such as rw-r--r--.
- Read the numeric and symbolic forms.
- Check what the owner, group and others are allowed to do.
- Copy the chmod command shown.
Choosing safe permissions
Grant the minimum access needed. Web content files are often 644 and directories 755, while configuration files with passwords should be readable only by their owner, such as 600.
Avoid 777, which allows any user to change the file and is a common cause of security problems on shared servers.
Symbolic chmod commands
chmod also accepts relative changes, such as chmod u+x script.sh to add execute permission for the owner, or chmod go-w file to remove write access for group and others.
The umask setting decides the default permissions of new files; a common umask of 022 gives files 644 and directories 755.
Formula & method
Each digit is the sum of read (4), write (2) and execute (1)Digits in order: owner (user), group, othersOptional leading digit: setuid (4), setgid (2), sticky (1)Symbolic form: r, w, x per class; s or S for setuid/setgid, t or T for stickyDigit per class = read (4) + write (2) + execute (1); classes in order: owner (user), group, others. Examples: 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--, 0 = ---. Optional special digit before them: setuid = 4, setgid = 2, sticky = 1. In symbolic form, setuid shows as s in the owner’s execute position (S if execute is not set), setgid as s or S in the group’s, and the sticky bit as t or T in the others’. For directories, read lists contents, write creates or deletes entries and execute allows entering the directory.
Worked example
chmod 755
- Owner 7 = 4 + 2 + 1: read, write and execute (rwx).
- Group 5 = 4 + 1: read and execute (r-x).
- Others 5: read and execute (r-x).
Answer: 755 = rwxr-xr-x, typical for scripts and directories.
Frequently asked questions
What does chmod 755 mean?
Owner full access; group and others read and execute.
What does chmod 644 mean?
Owner read and write; group and others read only.
How do I calculate a permission digit?
Add read 4, write 2 and execute 1.
What is the sticky bit?
A mode that lets only owners delete their files in a shared directory.
What is setuid?
A mode that runs a program with the file owner’s privileges.
Is chmod 777 safe?
Generally no, it lets anyone modify the file.