More on File Permissions

What you can and can't do with a file, as defined by your user or group name, is pretty much wrapped up in four little letters. Each of these letters in turn can be referenced by a number. They are r, w, x, and s. Their numerical representations are 4, 2, 1, and "it depends." To understand all that, you need to do a little binary math.

Reading from right to left, think of the x as being in position zero. The w, then, is in position 1, and the r is in position 2. Here's the way it works:

2 to the power of 0 equals 1

(x is 1)

2 to the power of 1 equals 2

(w is 2)

2 to the power of 2 equals 4

(r is 4)

To specify multiple permissions, you can just add the numbers together. If you want to specify both read and execute permissions, simply add 4 and 1, and you get 5. For all permissions (rwx), use 7.

File permissions are referenced in groups of three rwx sections. As you might expect, the r stands for "read," the w means "write," and the x denotes that the file is executable.

Although these permissions are arranged in three groups of three rwx combinations, their meaning is the same in all cases. The difference has to do with who they represent, rather than the permissions themselves. The first of these three represents the user, the second trio stands for the group permissions, and the third represents everybody who doesn't fit into either of the first two categories.

The commands you will use for changing these basic permissions are chmod, chown, and chgrp.


CHange the MODe of a file (aka its permissions)


CHange the OWNer of the file or directory


CHange the GRouP of the file or directory