I have a system where the permissions of many files are messed up. I have another system that has the same files, if I put that hard drive in, without simply overwriting the files, is there a way where I can recursively set the permissions of each file to that of this other directory? Thanks, CP
|
feedback
|
|
getfacl / setfacl. Assume the 'good' directory is "SRC" and the 'bad' directory is 'TARGET'. Assume that you want to copy permissions recursively.
It will complain about items in SRC that are not in TARGET, and will not notice items in TARGET that are not in SRC. Also, since it transfers permissions only, files with the same name but different contents will have only the permissions updated. In theory, if two objects have the same name but are different types something weird might happen. For example, if SRC/a is a file, but TARGET/a is a directory. Also, you'll need to read the getfacl man page to see how links, symlinks, and other non-file objects are treated. | |||
|
feedback
|
|
Did you try;
"p" flag keeps ownership, timestamp and "r" flag run command recursively. | |||||
feedback
|
|
I think getfacl and setfacl would be the way to go. | |||||
feedback
|
rsyncone), orgetfacl? – slhck May 24 '11 at 7:24find /var/log -type d -printf "chmod %m %p \n" > reset_permsThanks. – CptanPanic May 25 '11 at 12:17