Change File Permission And File Owner CHMOD CHOWN

chown command is used to change owner of the file

here below the file first has owner hari and group admin is the group.

[root@rhcsa hari]# hari admin 0 Mar 26 20:09 first

now if we need to change the owner to harry and group to accounts then we can use following command

[root@rhcsa hari]# chown harry:accounts first

Above we changed owner of the file first to harry and

changed group owner to accounts from admin

If you need to just change either owner or group then

just change the owner or group and leave the one that you dont want to change

changing owner only to ram

[root@rhcsa hari]# chown ram first
[root@rhcsa hari]# ls -l
-rwxrw-r--. 1 ram accounts 0 Mar 26 20:09 first

change group only

[root@rhcsa hari]# chown :admin first
[root@rhcsa hari]# ls -l
-rwxrw-r--. 1 ram+ admin 0 Mar 26 20:09 first



this command is used to change the file permission of the file

-rw-rw-r--. 1 hari admin 0 Mar 26 20:09 first

now if you need the permission of the file first to be




then we can do this by

[root@rhcsa hari]# chmod 764 first
[root@rhcsa hari]# ls -l
-rwxrw-r--. 1 hari admin 0 Mar 26 20:09 first

the method above is for numerically assigning the permission


there is another method to assign permission

  • u is for user,
  • g is for group,
  • and o is for others

1. Add single permission to a file/directory

Changing permission to a single set. + symbol means adding permission. For example, do the following to give execute permission for the user irrespective of anything else:

$ chmod u+x filename

2. Add multiple permission to a file/directory

Use comma to separate the multiple permission sets as shown below.

$ chmod u+r,g+x filename

3. Remove permission from a file/directory

Following example removes read and write permission for the user.

$ chmod u-rx filename

4. Change permission for all roles on a file/directory

Following example assigns execute privilege to user, group and others (basically anybody can execute this file).



$ chmod a+x filename





Leave a Reply