Linux: just copy the file permissions and ownership

 

On Linux, how the <rights and Owners> assign a file to another file it?

chown command to set the owner and user groups; chmod can set file permissions. Both commands support the use of another file as a reference (RFILE).

 

Copy a file / directory permissions to another file

The syntax is as follows:

Replace RRFILE you want to use the file permissions, for example:

Screen Shot 2016-03-21 at 11.11.06

The file permissions assigned to a file b.

You can also specify multiple files:

And find, xargs combination (set all file permissions of a directory):

 

The owner of the copy of a file / directory to another file

chown general use OWNER: GROUP as an option argument.

And chmod syntax used here is similar:

E.g:

Screen Shot 2016-03-21 at 11.20.46

Guess you like

Origin www.cnblogs.com/larry-luo/p/10984993.html