Wednesday, June 2, 2010

Linux Files and Folder Permission examples

understanding file permission... with some examples.

what is this drwxr-xr-x about?

first think to understand is that we have 4 fields

1. file type | 2. user | 3. group | 4. other





1. The first character in the field indicates a file type of one of the following:

d = directory
l = symbolic link
s = socket
p = named pipe
- = regular file
c= character (unbuffered) device file special
b=block (buffered) device file special

most of the times you will see "d" or "-" or "l"

2. the user (primary owner) permissions.


3. the group permissions.


4. and others

just try to remember

user = u
group = g
other = o



there are 3 types of access

1. read
2. write
3. execute

rwx


lets see some example

yaniv@yaniv-ub:/tmp/test$ ls -ld folder1/
drwxr-xr-x 2 yaniv yaniv 4096 2010-06-02 10:15 folder1/
yaniv@yaniv-ub:/tmp/test$
so we see drwxr-x-r-x

lets look at the 4 fields: d| rwx | r-x | r-x

field 1: d = directory
field 2: the user (primary owner) = read, write, execute
field 3: the group = read, execute
field 4: other = read, execute

to be continued soon...

No comments: