Will Clarke

UNIX Permissions for no0bs

2014-10-18

File permissions can either be: r, w or x. Readable, Writeable or eXecutable.

There are also 3 ‘tiers’ of access allowed: ‘Owner’, ‘Group’ & ‘Other’ These 3 different access levels can be represented like this:

Owner: rwx Group: rwx, Other: rwx

This can be shortened to: rwxrwxrwx

In the previous example, anyone is able to read, write(edit) or execute(run) the file. To disallow them, you can substitute -s in:

Clever programmers like to do things with the minimum system requirements; reading 9 letters for each file would be energetically expensive / resource intensive. To solve this problem, they often shorten this syntax (rwxrwxrwx) even more using binary.

They say that:

Using these simple rules, you can efficiently say that, in decimal (or octal) numbers:

Hopefully that makes sense. Read + Execute = 4 + 1 = 5. Geddit?

Anyway, this system allows us to transform:

A common file permission to set is chmod 755, which is rwx for the Owner but only rw- for other users.


Tags

unix shell bash