This page starts with an example command for an SSH key.
How Unix permissions work
Every file and directory on Linux, macOS and other Unix-like systems has an owner, a group and three sets of permissions: one for the owner (u), one for members of the group (g) and one for everyone else (o). Each set has three bits: read (r), write (w) and execute (x). Running ls -l shows them as a ten-character string such as -rwxr-xr-x, where the first character is the file type and the next nine are the permission bits. ChmodCalc lets you set those bits with checkboxes and shows the matching octal number and symbolic string at the same time.
Octal notation
The chmod number packs each set into one digit by adding read = 4, write = 2 and execute = 1. So 7 is rwx, 6 is rw-, 5 is r-x and 4 is r--. A mode of 755 is rwx for the owner and r-x for the group and others, and 644 is rw- for the owner and r-- for everyone else. A leading fourth digit sets the special bits: 4 for setuid, 2 for setgid and 1 for the sticky bit, so 4755 is a setuid program and 1777 is a world-writable directory with the sticky bit, like /tmp.
Files versus directories
On a file, read lets you open it, write lets you change it and execute lets you run it as a program or script. On a directory, read lets you list the names inside, write lets you create, delete and rename entries, and execute lets you enter the directory and access the files in it. That is why directories usually need the execute bit wherever they have read, and why a common pattern is 755 for directories and 644 for files.
Symbolic changes and umask
Instead of setting the whole mode, chmod can change individual bits with symbolic expressions: chmod u+x script.sh adds execute for the owner, chmod go-w file removes write for group and others, and chmod a=r file sets read-only for everyone. The umask controls the permissions of newly created files by removing bits from 666 for files and 777 for directories. The default umask of 022 gives 644 files and 755 directories. Nothing you enter here touches your system; copy the command and run it yourself.
Frequently asked questions
What permissions does ~/.ssh need?
700 for the directory, 600 for private keys and authorized_keys, 644 for .pub files.
Is 400 better than 600?
400 is read-only and also works for keys; 600 lets you edit the file.
Does chmod work on Windows?
Not natively. Use WSL or Git Bash, or file properties in Windows.
Is ChmodCalc free?
Yes, with no sign-up or ads.
Does it change my files?
No. It only builds commands for you to run yourself.