You can copy the permissions from one file to another using the chmod
command with the --reference
option on a Linux system. The following command will copy the permissions from the file reference_file
to the file target_file
:
chmod --reference=reference_file target_file
This will set the permissions of target_file
to be exactly the same as those of reference_file
. Note that the ownership and timestamps of target_file
will not be changed.