ubuntu linux

Every thing on ubuntu linux

&
 

Archive for December, 2008

Dec 31 2008

Understanding and setting permissions

Published by linuxubuntu under Uncategorized Edit This

Reading file and directory permissions with: ls -sl

* Reading file and directory permissions with: ls -sl
!Example
4 drwxr-x— 2 user user 4096 Feb 17 15:04 images/
4 -rw-rw-r– 1 user user 624 Feb 11 09:08 index.htm
4 drwxr-xr-x 2 user user 4096 Feb 17 15:04 public/
4 -rwxrwxrwx 2 user user 4096 Feb 17 15:04 foo.txt
!
o There are 10 location in the permission string:
1) First location is either d (directory) or - (file)
2) Read permission for User (1st name, fourth column)
3) Write permission for User
4) Execute permission for User
5) Read permission for Group (2nd name, fifth column)
6) Write permission for Group
7) Execute permission for Group
8) Read permission for Global (everyone)
9) Write permission for Global
10)Execute permission for Global

o In the above example, the directory images/ has read-write-execute permissions for the User user,read-execute permissions for the Group user, and no permissions for Global. No person except for the User user may make changes to this directory.

o The file index.htm has read-write permissions for the User and Group, is readable by Global, and eexecutable by nobody.

o The directory public/ has the same User and Group permissions as images/, but this directory may be read or executed by Global.

o The file foo.txt has read-write-execute permissions for User, Group, and Global

* Setting permissions with: chmod

o Useage: chmod ### foo
o # is set by summing the allowable permissions using the mapping:
oo 1 - Execute
oo 2 - Write
oo 4 - Read

!Examples
o To set the permissions for images/: chmod 750 images/
o To set the permissions for index.htm: chmod 664 index.htm
o To set the permissions for public/: chmod 755 public/
o To set the permissions for foo.txt: chmod 777 foo.txt

No responses yet

Next »