Công Cụ Nhanh

Chmod calculator

For example 755, 644, 0640, 2775.

For example rwxr-xr-x; a full ls -l string like -rw-r--r-- also works.

Common permissions

Permission grid
Permission gridRead rWrite wExecute x#
Owner (u)7
Group (g)5
Others (o)5
Special bits

Applied to the current mode, e.g. u+x, go-w, a=r, u=rwx,g=rx,o=

755

Shown by ls -l: -rwxr-xr-x

Owner (u)
On a file: read the contents, change the contents, run it as a program / script
On a folder: list the names inside, create, delete and rename entries (needs x too), enter the folder and reach files inside
Group (g)
On a file: read the contents, run it as a program / script
On a folder: list the names inside, enter the folder and reach files inside
Others (o)
On a file: read the contents, run it as a program / script
On a folder: list the names inside, enter the folder and reach files inside

Commands

  • chmod 755 wp-config.php
  • chmod u=rwx,g=rx,o=rx wp-config.php
  • ls -l wp-config.php # -rwxr-xr-x

Set permissions for a whole website tree (run inside the site folder)

find . -type d -exec chmod 755 {} + find . -type f -exec chmod 644 {} + chmod 600 wp-config.php

Processed in your browser. Your files and data are never uploaded to a server.

Quick answer

Each chmod digit is the sum of one class's permissions: read = 4, write = 2, execute = 1. The first digit is the owner, the second the group and the third everyone else. So 755 = rwxr-xr-x (owner has full access, others can read and execute) and 644 = rw-r--r-- (owner reads and writes, others only read).

What is chmod?

Tick read, write and execute for owner, group and others to see the chmod number (755, 644, 0640) and the rwxr-xr-x string that ls -l shows, or type / paste either form to convert it back. The calculator covers the setuid, setgid and sticky bits, explains what each permission means on a file versus a folder (they differ a lot), lets you try symbolic commands such as u+x or go-w, warns about risky modes like 777, and includes common hosting presets for aaPanel or cPanel with chmod commands to copy.

Illustration of a three-drawer filing cabinet, each drawer with a small padlock in a different state (locked, open, half open), and a ring of three keys on a hook

How to calculate chmod permissions

  1. 1

    Tick Read, Write and Execute in the Owner, Group and Others rows; the number and the rwx string update instantly.

  2. 2

    Or type a number (755) or paste an ls -l string (-rw-r--r--) into the matching box to see the grid and the meaning.

  3. 3

    Pick a preset such as “644 · web files” or “600 · wp-config.php, .env” when you are configuring a website.

  4. 4

    Enter the file name under “Commands” and copy the chmod command to run on your server (over SSH or a hosting terminal).

What each digit means

DigitSymbolicPermissions
0---No access
1--xExecute only
2-w-Write only
3-wxWrite and execute
4r--Read only
5r-xRead and execute
6rw-Read and write
7rwxRead, write and execute

Recommended website permissions (WordPress, Laravel, PHP)

WhatModeNotes
All folders755 (or 750)The web server needs x to enter a folder and r to list it
All .php, .html, .css files and images644 (or 640)The owner can edit, the web server can read
wp-config.php, .env600, 440 or 400Holds database passwords; the fewer readers the better
uploads, cache, storage folders755, owned by the PHP userFix the owner (chown) instead of opening 777
~/.ssh and private keys700 for the folder, 600 for keysSSH refuses keys with looser permissions

Based on WordPress's security guide (developer.wordpress.org, Hardening WordPress): folders 755 or 750, files 644 or 640, wp-config.php 440 or 400.

r, w and x on files vs folders

PermissionOn a fileOn a folder
r (read)View the contentsList the names inside (ls)
w (write)Change or overwrite the contentsCreate, delete and rename entries (needs x too)
x (execute)Run it as a program or scriptEnter the folder (cd) and open files inside by name

Real-world examples

WordPress cannot write files

This is usually the wrong owner, not missing permissions. Check with ls -l: wp-content should belong to the user PHP runs as, with mode 755. 777 is not needed.

Protecting wp-config.php

Pick the “600 · wp-config.php, .env” preset, enter the file name and copy chmod 600 wp-config.php. Only the owner can read and write it; if PHP runs as another user, use 640 with the right group.

A backup script will not run

“Permission denied” when running ./backup.sh means it lacks execute permission. Try u+x in the symbolic box: 644 becomes 744, then run chmod u+x backup.sh.

A shared team folder

The 2775 preset (setgid) makes every file created in the folder belong to the folder's group, so team members can edit each other's files.

Common mistakes

Setting 777 on the whole site to fix permission errors.
777 lets every process on the machine write there, a classic route for malware. Fix the owner with chown so it matches the PHP user, and keep 755 / 644.
chmod -R 644 makes the site go blank.
-R also applies to folders, which lose x so nobody can enter them. Set them separately: find . -type d -exec chmod 755 {} + and find . -type f -exec chmod 644 {} +.
SSH says “UNPROTECTED PRIVATE KEY FILE”.
Private keys must be 600 (or 400) and ~/.ssh must be 700; SSH rejects keys that other users can read.
setuid on a PHP or bash script does nothing.
Linux ignores setuid on scripts for safety. If you need elevated rights, use sudo with a narrow rule.

The fourth digit (setuid, setgid, sticky)

When a mode has four digits, such as 2775 or 1777, the first one holds the special bits: 4 = setuid, 2 = setgid, 1 = sticky. ls -l shows them as s or t in place of x; a capital S or T means the special bit is set without execute permission, which is usually a mistake.

A leading zero as in 0644 is just octal notation in many languages (PHP chmod('a.txt', 0644)); for the chmod command, 0644 and 644 are the same.

Glossary

chmod
The Linux / Unix command that changes a file's or folder's access mode.
chown
The command that changes a file's owner and group, e.g. chown www-data:www-data index.php.
Owner (u)
The user who owns the file, usually whoever created it.
Group (g)
The user group assigned to the file; its members get the second digit's permissions.
Others (o)
Every other user on the machine, including the web server process if it is neither owner nor in the group.
umask
A mask that removes permissions from new files; umask 022 gives files 644 and folders 755.

Frequently asked questions

What does chmod 755 mean?

The owner can read, write and execute (7); the group and others can read and execute (5). It is the standard mode for website folders and scripts that need to run.

What does chmod 644 mean?

The owner can read and write (6); the group and others can only read (4). It is the standard mode for HTML, PHP and image files on a website.

Should I ever use chmod 777?

Almost never on a web server. Fix “cannot write” errors with chown to the right user, or 775 if a group needs to write too.

How do I see a file's current permissions?

Run ls -l filename to see -rw-r--r--, or stat -c '%a %n' filename to see 644. Hosting file managers usually show a Permissions column.

How do I change permissions recursively?

chmod -R applies one mode to everything and easily strips x from folders. Use find to set folders (755) and files (644) separately, as in the commands in the tool.

Does Windows have chmod?

Windows uses its own ACLs; chmod only means something on Linux, macOS or inside WSL. The permissions shown in FileZilla or a hosting file manager are chmod on the server.

Ratings and comments

Loading…