File Permission

How to read - rwx rwx rwx

- means file
r means read
w means write
x means excute
first rwx is for user permission
next rwx is for group permission
and last rwx is for other permission

- means permission is for file
d means permission is for directory
l means for links
p means for process file
s means for socket file
b means for block device
c means for character device

Note:The above character used to identify the permission for file or directory or other file type. If permission started with d instead of - .It means particuler permission is for directory.





How to change the file or directory permission

chmod command is used to change the permission

File or Directory permission can be change in two ways:

Method 1
chmod <permission> <file or directory name>
eg:
1 : if user file permission change from rwx to rw only
chmod u+rw filename
2 : if user and group file permission change from rwx to rw only
chmod ug+rw filename

Method 2
chmod <permission> <file or directory name>
eg:
1 : if user file permission change from rwx to rw only ,group file permission change from rwx to r only and other file permission change from rwx to r only
chmod 644 filename




Changing file ownership


You can change the owner of a file by using the chown command
chown <new user name> <file name>
eg:
1 : I wanted to change the owner of file from "Haktuts" to "hak".
chown hak filename

Changing group ownership


You can change the owner of group by using the chgrp command
chgrp <new user name> <file name>
eg:
1 : I wanted to change the owner of group from "Haktuts" to "hak".
chgrp hak filename

Changing user and group ownership


chown <user>:<group> filename
eg:
if user want to change both user and group ownership
chown haktuts:hak filename

© 2014 HaKTuts. All rights reserved.