Monday, February 23, 2009

Quick understanding ownership and permissions in Linux

List all file and folder with permisson info:-
harith@cengkeh:~/test$ ls -lah
total 8.0K
drwxr-xr-x 2 harith harith 4.0K 2009-02-23 03:12 .
drwxr-xr-x 48 harith harith 4.0K 2009-02-23 03:12 ..
-rw-r--r-- 1 harith harith 0 2009-02-23 03:12 file1
-rw-r--r-- 1 harith harith 0 2009-02-23 03:12 file2
-rw-r--r-- 1 harith harith 0 2009-02-23 03:12 file3
harith@cengkeh:~/test$

Understanding file/folder permission:-
-                (rw-)          (rw-)          (r--)           1               Harith          Harith
|                  |                 |                 |
type            owner      group        others

Type of file (type)

d                — a directory/folder
-(dash)    — a regular file
l                 — a symbolic link to another program or file elsewhere on the system

r — file can be read
w — file can be written to
x — file can be executed (if it is a program)

0 comments: