Linux CHMOD File Permission Secret Coding from the 1970s

Linux CHMOD File Permission Secret Coding from the 1970s

CHEATER CALCULATOR — > http://chmod-calculator.com/

chmod owner|group|world filename

Numeric equivalents (octal) based on the table below:

4 read (r)
2 write (w)
1 execute (x)

Practical Examples:
chmod 400 mydoc.txt read by owner
chmod 040 mydoc.txt read by group
chmod 004 mydoc.txt read by everyone
chmod 200 mydoc.txt write by owner
chmod 020 mydoc.txt write by group
chmod 002 mydoc.txt write by everyone
chmod 100 mydoc.txt execute by owner
chmod 010 mydoc.txt execute by group
chmod 001 mydoc.txt execute by everyone

Adding up the numbers to get other types of permissions:
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)

chmod 666 mydoc.txt read/write by everyone
chmod 755 mydoc.txt rwx for owner, rx for group and rx for the world
chmod 777 mydoc.txt read, write, execute for all

Comments are closed.