Linux file permissions

July 11, 2007

To show the file permissions type:

ls --color -l

This, shows something like this

-rw-r–r– 1 root root 817 2006-06-05 13:20 script
-rw-r–r– 1 peter usuarios 143360 2007-07-11 23:29 typescript

The “-rw-r–r–” line part, shows the file permissions to the OWNER, GROUP and OTHERS. In this example, the OWNER can “read” and “write”, the GROUP can “read”, and OTHERS can “read”. If the first character it’s a”d”, this means, that it’s a directory.

To change permissions, we use “chmod” command. The chmod sintaxis it’s, “chmod [number]”, the number represents the permissions we want to apply. To obtain this, we can use google 😛 or this calculator http://wsabstract.com/script/script2/chmodcal.shtml

Maybe you can use this simple table:

Value Permission
1 –x
2 -w-
3 -wx
4 r–
5 r-x
6 rw-
7 rwx

For example, if we apply a file the command “chmod 777”, that means, ALL users, can READ, WRITE and EXECUTE the file. If we apply “chmod 600”, Only the OWNER can READ and WRITE, the rest of users cannot use the file.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: