File permissions · modechmod 644rw-r--r--

What chmod 644 (rw-r--r--) means, who is allowed to do what, and when these permissions are used: an ordinary file: the owner edits, everyone else reads.

Open in the calculator
Class by classfile
6
Owner
Read the contents, change and save it.
4
Group
Read the contents.
4
Others
Read the contents.
When and why

The default for text, images, configs and web pages. Nobody needs the execute bit: the file is not a program.

A private key needs 600
ssh refuses a key readable by anyone but its owner: «Permissions are too open». If this is a key or an .env file, set 600.
Mode
Octal644
Symbolicrw-r--r--
ls -l line-rw-r--r--
Command
chmod 644 file
01

What breaks

A script with 644 will not run

bash: ./deploy.sh: Permission denied

Nobody has the execute bit, the owner included — a script needs 755. The mirror mistake is just as common: 644 on a directory. You cannot get inside, and ls answers «Permission denied», because a directory needs the x bit.

02

Easily confused with

755rwxr-xr-x

the same plus execution: what a script and any directory need.

chmod 755
640rw-r-----

outsiders cannot read at all — for a config a service reads under its own group.

chmod 640
600rw-------

nobody but the owner reads it: keys and .env files.

chmod 600
03

Commands for this case

find . -type f -exec chmod 644 {} +

apply 644 to files only, leaving directories alone

chmod 644 index.html style.css

the ordinary case of a few files

Work out other permissions

The calculator opens on this mode: checkboxes, octal and symbolic notation, an ls -l line and the ready command.

Open the calculator on this modeAll common modes

Updated

«» added to favorites