If you need to change the ownership permission of file then you can use chown command. Through chown command you can change file’s owner and group information. You can change the file access permission such as write, read and access.

Here are the syntax of chown command :
  • chown owner-user file
  • chown owner-user: owner-group file
  • chown owner-user: owner-group directory
  • chown options owner-user: owner-group file

Now let’s see how to use these commands with example :

For example you have to change the permission of exam.txt file, then first list the permission for the file exam.txt with below command :

Code:
# ls -l exam.txt
The following will be the output:

Code:
-rw-r--r-- 1 root root 0 Aug 17 05:48 exam.txt
Now you have to change the file permission from root to admin with following command :

Code:
# chown root exam.txt
And again list the permission for the file.

Code:
# ls -l exam.txt
The output will be this :

Code:
-rw-r--r-- 1 admin root 0 Aug 17 05:48 exam.txt
Author
bhawanisingh
Views
1,615
First release
Last update
Rating
0.00 star(s) 0 ratings
Top