Labels

algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

Linux File Permissions

  Text Binary Directory
Read cat <file> cp /bin/ls ls
Write cat > <file> cc a.c rm <directory>
eXecute ./<file> ls cd <directory>

 

Only 2 users can change the permissions of a file

  • the Owner
  • super user or root

ls -l
Owner-Group-Others HardLinks username groupName bytes date filename

drwxrwxr-x 2 trainee trainee 4096 Jun 14 15:03 as
-rw-rw-r-- 1 trainee trainee    0 Jun 14 14:27 f2
-rw-rw-r-- 1 trainee trainee  148 Jun 14 14:28 f3
-rw-rw-r-- 1 trainee trainee  148 Jun 14 14:28 f4
-rw-rw-r-- 1 trainee trainee  888 Jun 14 14:29 f5
-rw-rw-r-- 1 trainee trainee    0 Jun 14 15:10 fruits
-rw-rw-r-- 1 trainee trainee    0 Jun 14 15:10 g1
-rw-rw-r-- 1 trainee trainee    0 Jun 14 15:10 g2

Change permissions on a file

  • Numerical: use chmod 777 filename all permissions to a file.
  • Symbolic: use chmod a+x,g-w <filename>    [User Group] [+/-] [r/w/x]

UMASK:

  • specifies what has to be denied
  • its only for newly created files

you can find out umask by typing umask

[trainee@localhost purna]$ umask
0002 the last three specify what permission to deny to the owner group and others

No comments:

Post a Comment

Search 24 Bytes