Commands Help : chown

  •  chown - change file owner and group

 

[SYNOPSIS] chown OPTION USER FILE/DIRECTORY

option
-Roperate on files and directories recursively
# chown -R user dir

 

Examples:

  1. 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.

  2. 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.

  3. 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

  4. To change group from a particular group:
    chown --from=:group1 root greek1

    Here, the group of greek1 is changed to root.

  5. To copy ownership of one file to another:
    chown --reference=greek1 greek2

  6. To change ownership of multiple files:
    chown master:group greek2 greek3 

Comments

Popular posts from this blog

Java : Variables Declaring

Install DNF in RHEL/CentOS 7

SQL Self JOIN