Permissions cheatsheet

chmod, chown

prepsat z http://blog.harvie.cz/useful-gnulinux-commands/

Meaning of RWX Combinations

Octal digit	Text equivalent	Binary value	Meaning
0	---	000	All types of access are denied
1	--x	001	Execute access is allowed only
2	-w-	010	Write access is allowed only
3	-wx	011	Write and execute access are allowed
4	r--	100	Read access is allowed only
5	r-x	101	Read and execute access are allowed
6	rw-	110	Read and write access are allowed
7	rwx	111	Everything is allowed

Meaning of RWX bits for files and folders

Access type	File	Folder
Read	If the file contents can be read	If the directory listing can be obtained
Write	If user or process can write to the file (change its contents)	If user or process can change directory contents somehow: create new or delete existing files in the directory or rename files.
Execute	If the file can be executed	If user or process can access the directory, that is, go to it (make it to be the current working directory)

Digital representation of setuid, setgid and sticky bits

Octal digit	Binary value	Meaning
0	000	setuid, setgid, sticky bits are cleared
1	001	sticky bit is set
2	010	setgid bit is set
3	011	setgid and sticky bits are set
4	100	setuid bit is set
5	101	setuid and sticky bits are set
6	110	setuid and setgid bits are set
7	111	setuid, setgid, sticky bits are set

Meanings of SUID, SGID and Sticky bits

SUID	If set, then replaces "x" in the owner permissions to "s", if owner has execute permissions, or to "S" otherwise. Examples: -rws------ both owner execute and SUID are set -r-S------ SUID is set, but owner execute is not set
SGID	If set, then replaces "x" in the group permissions to "s", if group has execute permissions, or to "S" otherwise. Examples: -rwxrws--- both group execute and SGID are set -rwxr-S--- SGID is set, but group execute is not set
Sticky	If set, then replaces "x" in the others permissions to "t", if others have execute permissions, or to "T" otherwise. Examples: -rwxrwxrwt both others execute and sticky bit are set -rwxrwxr-T sticky bit is set, but others execute is not set