Wednesday, October 5, 2011

How to configure Linux Files Permissions?




Three types of permission read write and execute, Ever file and folder have three relations owner group and
others
[ Read = r write = w execute = x ] [ owner = u group = g other = o ]
[root@pc1  ~] #  Ls  -Ld  /disk

1= nature of object [d=dir -=file L=link]
2= first three permission for owner [ rwx ]
3= second three permission for group members [ r-x]
4= third three permission for others [r-x]
5= number of inodes contain by this directory
6= owner of directory
7= group of directory
8= size of directory
9= creating date of object
10= name of object


[root@pc1  ~] #   Ls  -L  /disk

Drwxr-xr – x   2   root   root   4096   Jan   1   1988   dir1

Drwxr-xr – x   2   root   root   4096   Jan   1   1988   dir2

Drwxr-xr – x   2   root   root   4096   Jan   1   1988   dir3

Changing permission = give write permission to other on /disk
[root@pc1  ~] #   chmod  0+w  /disk
Give read write and execute permission for group on /disk
[root@pc1  ~] #   chmod  g+rwx  /disk
Assigning read writ and execute permission to user, group and other with single command
[root@pc1  ~] #   chmod    u+rwx , g+rwx, o – rwx  /disk

Assigning different permission with different commands which separate with semicolon
[root@pc1  ~] #   chmod   u+rwx   /disk  ;  chmod  g+rwx   /disk  ;  chmod  0+rx  /disk
Using number system =----- [ Read = 4 ] [ Write = 2 ] [ Execute = 1 ]
rwx=7
r-x=5
---=0
Assigning full permission to owner and no permission for group and others
[root@pc1  ~] #   chmod  700 /disk
Assigning full permission for owner and group no permission for other
[root@pc1  ~] #   chmod  700 /disk
Assigning full permission to all
[root@pc1  ~] #   chmod  777 /disk
Assigning full permission for owner and read, and execute for group and others
[root@pc1  ~] #   chmod  755 /disk
Assigning no permission for all
[root@pc1  ~] #   chmod  000 /disk
Assigning sticky bit permission for other
[root@pc1  ~] #   chmod  o+t   /disk
Assigning suid permission for owner
[root@pc1  ~] #   chmod  u+s  /disk
Assigning sgid permission for group
[root@pc1  ~] #   chmod  g+s  /disk

Overview of the Linux file system

/bin          All commands which are used by normal users
/etc          System conf files
/var          Server data logs Mail proxy cache
/dev         All devices name stored in /dev
/sbin        All commands which are used by supper user
/boot        Linux kernel ( vmlinuz , initrd ) Grub directory
/usr          All gui tools installed in /usr
/proc       System information’s ( picture of RAM )
/home     User's home dir's
/tmp        Temporary files
/media      Auto mounted devices mount point in /media



     








No comments: