Works on this device
Linux Permissions Calculator
Work out Linux and Unix file permissions. Type a number such as 755, the letters rwxr-xr-x, or tick the boxes, and see all three forms with the chmod command. The page only calculates: it does not touch any file.
Your permissions
Check these values
Your values are worked out in this browser. They are not sent to a server.
The result will show here
Type the permissions, then choose Calculate.
Permissions
How it was worked out
How to use the permissions calculator
- Choose what you have: an octal number, the symbolic form, tick boxes, a umask, or a chmod change to apply.
- Type the value. The result shows as you type.
- Choose whether it is for a file or a folder. Some bits mean different things for the two.
- Under More options you can type the file name. The page then writes the full
chmodcommand, with quotes when the name needs them. - Choose Copy result, Download CSV or Print to keep the result.
How Linux permissions work
Every file and folder has three classes of users: the owner, the group and all others. Each class has three permissions: read, write and execute.
In the symbolic form each class is three characters: r, w and x, or - when the permission is missing. rwxr-xr-x means the owner has all three, and the group and others can read and execute.
In the octal form each class is one digit: read is 4, write is 2 and execute is 1, added together. rwx is 4 + 2 + 1 = 7 and r-x is 4 + 1 = 5, so rwxr-xr-x is 755.
| Permission | For a file | For a folder |
|---|---|---|
| Read (r, 4) | See what is in the file | List the names inside the folder |
| Write (w, 2) | Change the file | Add, delete and rename entries in the folder (execute is needed too) |
| Execute (x, 1) | Run the file as a program | Enter the folder and reach the files inside it |
| setuid (4000) | A program runs with the rights of the file owner | No effect on Linux |
| setgid (2000) | A program runs with the rights of the file group | New files inside get the group of the folder |
| Sticky bit (1000) | No effect on Linux | Only the owner of an entry may delete or rename it |
Worked examples
chmod 644 notes.txt: 6 is read and write for the owner, 4 is read for the group, 4 is read for others. The symbolic form is rw-r--r--.
chmod 755 run.sh gives rwxr-xr-x: everyone can read and run the file, and only the owner can change it.
Start with 644 and apply u+x,go-w. u+x adds execute for the owner: 744. go-w removes write from the group and others, who did not have it: still 744, which is rwxr--r--.
With umask 022, a new file gets 666 without the bits of 022, which is 644. A new folder gets 777 without them, which is 755.
A fourth digit in front sets the special bits. 4755 shows as rwsr-xr-x, and 1777 shows as rwxrwxrwt.
The chmod change form
- A change names who (
uowner,ggroup,oothers,aall), then+to add,-to remove or=to set exactly, then the permissions. - Join several parts with commas:
u=rwx,g=rx,o=. X(capital) adds execute only for a folder, or for a file that already has execute for someone.chmod -R a-x+Xis a common use.sis setuid withuand setgid withg.tis the sticky bit.g=ucopies the permissions of the owner to the group.- With no who, as in
+x, all classes are meant, but bits that are set in your umask are left alone. With umask 022,+wadds write for the owner only.
Limits you should know
- The page calculates and writes commands. It does not run them and cannot read the permissions of your files.
- It covers the classic mode bits. Access control lists (ACLs), SELinux labels, file attributes and Windows permissions are not covered.
- The rules for a change follow GNU chmod, which Linux systems use. Other systems, such as BSD and macOS, can differ in small points, for example in how
Xand the special bits of folders are handled. - For a folder, GNU chmod keeps the setuid and setgid bits when you give a number. Use
u-s,g-sto clear them. - Be careful with
777and with setuid. They can open a system to misuse. If you are not sure, ask the person who runs the system. - The file name is quoted for a POSIX shell such as bash. Check the command before you run it, above all with
sudoor-R.