Chmod calculator

Tick the permissions you want, or type a mode like 755 or rwxr-xr-x, and get the octal and symbolic forms, a plain-English explanation and the chmod command to copy. Setuid, setgid and the sticky bit are included.

Permissions
ReadWriteExecuteOwnerGroupOthers
It’s a

Permissions

755 -rwxr-xr-x

    Common permissions

    How Unix permissions work

    Every file and directory has three sets of permissions: one for its owner, one for its group and one for everyone else. Each set has three switches: read (r), write (w) and execute (x). That’s nine switches in all, which ls -l prints as nine letters like rwxr-xr-x, with a dash for each one that’s off.

    For a file, read means you can see what’s in it, write means you can change it and execute means you can run it as a program. For a directory they mean something a little different: read lets you list the names inside, write lets you add, rename and delete files, and execute lets you go into it and open what’s there. A directory nearly always needs execute wherever it has read.

    Reading octal modes

    Octal packs each set of three switches into one digit. Read is worth 4, write 2 and execute 1, and you add up the ones that are on. So rwx is 4 + 2 + 1 = 7, r-x is 4 + 1 = 5 and r-- is 4. Three digits give owner, group and others, in that order.

    DigitLettersMeaning
    7rwxRead, write and execute
    6rw-Read and write
    5r-xRead and execute
    4r--Read only
    3-wxWrite and execute (rare)
    2-w-Write only (rare)
    1--xExecute only
    0---Nothing

    A fourth digit in front sets the special bits: 4 for setuid, 2 for setgid and 1 for the sticky bit. So 4755 is 755 with setuid, and 1777 is the mode of /tmp.

    A worked example

    Say you want a config file that you can edit, your team can read and nobody else can see. That’s read and write for the owner (4 + 2 = 6), read for the group (4) and nothing for others (0): chmod 640 app.conf. In letters, rw-r-----. Tick those boxes above and the calculator gives the same answer.

    Symbolic changes

    Instead of setting the whole mode, you can change parts of it. A symbolic change has who (u owner, g group, o others, a all), an operator (+ add, - remove, = set exactly) and the permissions. Join several with commas.

    • chmod u+x script.sh: let the owner run it.
    • chmod go-w file: stop the group and others changing it.
    • chmod a=r,u+w file: everyone can read, only the owner can write (644).
    • chmod g=u file: give the group the same permissions as the owner.
    • chmod -R a+X folder: capital X adds execute only to directories and files that someone can already execute, so you can fix a whole tree without making every file runnable.

    Type a change into “Change it with chmod syntax” to see what it does to the current mode before you run it.

    Common modes

    OctalSymbolicTypical use
    644rw-r--r--Normal files: you can edit, everyone can read
    755rwxr-xr-xScripts, programs and most directories
    600rw-------Private files: SSH keys, .env, passwords
    700rwx------Private directories, like ~/.ssh
    664rw-rw-r--Shared files a group can edit
    775rwxrwxr-xShared directories a group can write to
    400r--------Read-only for you, hidden from others
    2775rwxrwsr-xTeam directory: new files keep its group
    1777rwxrwxrwtShared drop directory, like /tmp
    777rwxrwxrwxEveryone can do everything. Avoid

    Common mistakes

    • Reaching for 777. If a web app can’t write to a folder, give the folder to the app’s user or group with chown and use 755 or 775.
    • Using -R with one mode for everything. chmod -R 755 makes every file executable. Set directories and files separately with find, as shown when you pick Directory above.
    • Forgetting execute on directories. With 644 on a directory, people can see the file names but can’t open any of them.
    • Leaving private keys readable. SSH and many other tools refuse keys that aren’t 600.

    Octal is just base 8: the number base converter shows the same mode in binary, where each bit is one switch. Scheduling a script once its permissions are right? Try the cron expression explainer.

    Questions people ask

    What does chmod 755 mean?
    The owner can read, write and execute (7 = 4 + 2 + 1). The group and everyone else can read and execute (5 = 4 + 1) but not change anything. It’s the usual mode for scripts, programs and directories. In symbolic form it’s rwxr-xr-x.
    What’s the difference between 644 and 755?
    Only execute. 644 (rw-r--r--) lets the owner edit and everyone read, which suits ordinary files like web pages and config. 755 adds execute for everyone, which a script needs to run and a directory needs before anyone can open it.
    Is chmod 777 safe?
    Rarely. It lets every user on the system change or delete the file, and on a web server that can let an attacker who gets in through one app change another. If something only works with 777, the real problem is usually the file’s owner or group. Fix that with chown and use 755 or 775 instead.
    What do the s and t letters mean?
    They’re the special bits. s in the owner’s execute spot is setuid: the program runs as its owner, which is how passwd can update a root-owned file. s in the group spot is setgid. t in the others spot is the sticky bit, which stops people deleting each other’s files in shared directories like /tmp. A capital S or T means the bit is set but execute isn’t.
    What permissions should SSH keys have?
    Your private key should be 600 (only you can read and write it) and the ~/.ssh directory 700. SSH refuses to use a private key that other people can read. Public keys and authorized_keys can be 644, though 600 also works.
    Why does chmod +x only change some bits for me?
    With no u, g, o or a in front, chmod applies your umask, so bits your umask blocks are left alone. With the common umask of 022, chmod +w only adds write for the owner. Write a+x or ugo+w to be explicit. This calculator treats a missing letter as a and says so.
    ↑↓ move↵ openesc close