chmod calculator
Permissions as 755, rwxr-xr-x and u+x, a ready chmod command and umask defaults.
The command appears when the permissions are set.
umask is three octal digits: 022, 027, 077.
Calculated in your browser — nothing is sent to the server
Practice on a machine
Lab “Wrong file permissions”
In a Linux terminal
stat -c '%a %A %n' script.sh
# 755 -rwxr-xr-x script.sh
chmod 755 script.sh
# set all permissions at once
chmod u+x,go-w script.sh
# add and remove single permissions
chmod -R u=rwX,go=rX /srv/www
# X: x for directories and programs only
umask
# the mask for new files, e.g. 0022
Keep in mindx on a directory is the right to enter it: without x you see the file names but cannot open the files.
Directory permissions
On a directory, r lists the names, w creates and deletes files (only together with x), and x lets you enter it and open files by name.
FAQ
What does chmod 755 mean?
The owner reads, writes and runs (7 = 4 + 2 + 1); the group and others read and run (5 = 4 + 1):
-rwxr-xr-x. It is set on programs, scripts and directories.
Why is chmod 777 a bad idea?
Any user and any compromised service can change the file. If permissions are missing, change the
owner (chown) or give rights to a group (775, 664).
What permissions do ~/.ssh and keys need?
~/.ssh needs 700 and a private key 600. With wider permissions, ssh refuses the key with
“UNPROTECTED PRIVATE KEY FILE”.