How to use
- Tick read, write and execute for owner, group and others.
- Or type a 3- or 4-digit octal value.
- Enable setuid, setgid or the sticky bit if needed.
- Copy the generated chmod command.
Use cases
- Fixing SSH key (600) and executable script (755) permissions.
- Setting up shared directories with setgid or the sticky bit.
- Understanding the permissions shown by ls -l.
Technical concepts
Octal notation
Each octal digit is the sum of read (4), write (2) and execute (1) for one class: owner, group and others, in that order. 755 means rwx for the owner (4+2+1) and r-x for group and others (4+1).
Special bits
An extra leading digit sets setuid (4), setgid (2) and sticky (1). setuid runs the file with its owner's permissions, setgid makes new files inherit the directory's group and the sticky bit prevents users from deleting others' files, as in /tmp (1777).
Execute on directories
On directories, x allows entering and accessing files, r allows listing the contents and w allows creating and removing entries.
Frequently asked questions
Which permissions should website files have?
Usually 644 for files and 755 for directories. Avoid 777, which lets any user change the content.
What does the uppercase S in rwSr--r-- mean?
setuid is set but the owner's execute bit is not, a combination that usually has no practical effect.