Copy File Permissions to Another File


To copy file permissions from one file to another file, use chmod command with the switch--reference in the following syntax, where reference_file is the file from which permissions will be copied rather than specifying the mode (i.e octal or numerical mode permissions) for the file.

$ chmod --reference=reference_file file


To copy ownership from another file, use the chown command with the switch--reference as well using the following syntax, where reference_file is the file from which owner and group will be copied rather than specifying owner: group values for the file.

$ chown --reference=reference_file file


To copy file permissions and ownership from one file to multiple files as shown.

$ sudo chmod --reference=users.list users1.list users2.list users3.list
$ sudo chown --reference=users.list users1.list users2.list users3.list

 

Kas see vastus oli kasulik? 2 Kasutajad peavad seda kasulikuks (8 Hääled)