linuxpermissionsfilesystems

How to set the mode of a file the same as an other's one?


The mode of a file A is 664 (-rw-rw-r--) but will not always be that. I have to find how to set the mode of a file B the same as the file A. Also, as the mode of A could change, B has to follow the changes and keep having the same mode as A.

I have find a cloning command but it seems that it's what was expected. The command is 'chmod reference=source_file target_file'


Solution

  • The chmod command can be used to accomplish this:

    chmod --reference=source_file_path target_file_path
    

    chmod handles general permissions mutations, and it handles this too.