Free tool · no signup

Chmod calculator and permissions checker

Tick the boxes to get the chmod number and the rwx string, or type a number to see what it means. Paste an ls -l listing to find files anyone can change, and get the commands for a WordPress site.

By the Bug Circuit security team · Last updated

Pick the permissions

ReadWriteExecute
Owner
Group
Everyone else
Number
755
Symbolic
rwxr-xr-x

Owner can read, write, run. Group can read, run. Everyone else can read, run.

Command
chmod 755 filename
What does chmod 755 mean? The owner can read, write and run the file, and everyone else can read and run it. For a website, folders should usually be 755 and files 644. 777 lets anyone on the server change the file and is almost never the right answer.

How it works

How the number works

Every file has three sets of permissions: for the owner, for the group and for everyone else. Each set is a sum: read is 4, write is 2 and execute is 1. So 7 is read, write and execute (4+2+1), 6 is read and write, 5 is read and execute, and 4 is read only. The three digits of 755 are the owner (7), the group (5) and everyone else (5). The same permission written as letters is rwxr-xr-x.

A fourth leading digit holds three special bits: setuid (4) and setgid (2) make a program run with its owner's or group's rights, and the sticky bit (1) on a folder means only a file's owner can delete it, which is how /tmp works. Websites rarely need any of them.

Permissions for a website

The usual safe values are 755 for folders (the web server must be able to enter them) and 644 for files. Files that hold secrets, such as wp-config.php or an .env file, should be tighter: 640 or 600, so other accounts on the server cannot read your database password. WordPress's own hardening guide suggests 440 or 400 for wp-config.php where your host allows it, as long as the web server can still read it.

The mistake that causes real damage is 777 (or 666 for a file). On shared hosting, other accounts, or a script running as a different user, can then rewrite your files, and one infected site can spread to its neighbours. If an upload or update fails with the right permissions, the cause is almost always file ownership: ask your host to fix the owner instead of opening the permissions.

Checking a whole folder

Run ls -la in your site folder and paste the output into the checker. It reads the permissions of each entry and flags files and folders anyone can write to, setuid files and secrets that other users can read, and prints the chmod command that fixes each one. The listing is read in your browser and goes nowhere.

Worked examples

Reading 755 and 644

Two common values.

755 = rwxr-xr-x  owner: read, write, run | group: read, run | others: read, run
644 = rw-r--r--  owner: read, write      | group: read      | others: read

755 suits folders and programs, 644 suits ordinary files such as pages and images.

Set WordPress permissions

WordPress installed in /var/www/html.

find /var/www/html -type d -exec chmod 755 {} ;
find /var/www/html -type f -exec chmod 644 {} ;
chmod 640 /var/www/html/wp-config.php

The first two commands reset every folder and file. The third tightens the config file.

A listing the checker flags

-rw-rw-rw- 1 www-data www-data 3107 Oct 22 12:00 wp-config.php

wp-config.php: file anyone can change (666)
fix: chmod 640 wp-config.php

Anyone with access to the server could read the database password and change the file.

Frequently asked questions

What does chmod 777 do?
It gives the owner, the group and everyone else permission to read, write and run the file. On a website that means any account or script on the server can change it. It is almost never necessary and it is a common way sites get taken over.
What permissions should WordPress files have?
Folders 755, files 644 and wp-config.php 640 or stricter. The wp-content/uploads folder needs to be writable by the web server user, which is a matter of ownership rather than opening permissions to everyone.
What is the difference between 644 and 640?
644 lets everyone read the file. 640 lets only the owner and the group read it, and everyone else gets nothing. Use 640 for files that hold secrets.
How do I change permissions on all files in a folder?
Use find with -type d for folders and -type f for files, as in the WordPress example. A plain chmod -R 755 would make every file executable, which you do not want.
What does the leading d or - in ls -l mean?
It is the file type: - for a regular file, d for a folder and l for a link. The nine letters after it are the permissions for the owner, group and everyone else.
What is the sticky bit?
On a folder it means only the owner of a file (or the folder's owner) can delete or rename files in it, even if others can write there. Shared temp folders such as /tmp use it. You will see it as a t at the end of the permission string.
Why do my uploads fail with 755 and 644?
Usually because the web server runs as a different user from the one that owns the files. Ask your host to set the right owner. Do not fix it by making files writable by everyone.

Keep reading

See what attackers see, for free

Run the free passive check on your website. No login, no impact on your site, results in seconds.

Ready for the full manual audit? See pricing

Chmod Calculator and WordPress Permissions · Bug Circuit