Commands Help : chown
- chown - change file owner and group
[SYNOPSIS] chown OPTION USER FILE/DIRECTORY
option
-R operate on files and directories recursively # chown -R user dir
Examples:
- To Change group ownership In our case I am using group1 as a group in the system. To change ownership we will use
chown :group1 file1.txt
You can see that the group permissions changed to group1 from root, if you use -v option it will report that. We just need to add a “:” to change group.
- To change the owner as well as group: Again taking master as user and group1 as a group in the system
chown master:group1 greek1
Here, greek1 is a file.
- To change the owner from particular ownership only: Suppose we want to change ownership from master to root where current owner must be master only.
chown --from=master root greek1
- To change group from a particular group:
chown --from=:group1 root greek1
Here, the group of greek1 is changed to root.
- To copy ownership of one file to another:
chown --reference=greek1 greek2
- To change ownership of multiple files:
chown master:group greek2 greek3
Comments
Post a Comment