Correcting owner/permissions on damaged directory tree in linux

Posted by mcs130 on Super User See other posts from Super User or by mcs130
Published on 2012-11-22T04:16:22Z Indexed on 2012/11/23 5:01 UTC
Read the original article Hit count: 452

Filed under:
|
|

I inadvertently made a backup copy of a directory recursively and forgot the -a (--preserve) switch when doing so. This damaged my backup directory (which contains data we need to access).

The directory and all of its child folders and files comprise an installation of an application including postgress DB and solr files. The original copy was used to for a failed re-config attempt. Now I need to use the backup copy to start over, only the ownership of the backup copy is now root across everything and it is no longer usable (processes won't run due to ownership problems I created when I forgot the -a on the cp -r).

I've re-installed a clean copy of the application into a 3rd location now (which has the correct owner/perms) and need to copy the owner/perms from this good directory over onto the damaged directory. What is the best way (if even possible) to do this.

(I've Googled and seen things from perl scripting to setfacl/getfacl to do this but am unfortunately still confused). Apologies if this seems a dumb question. Thanks.

© Super User or respective owner

Related posts about permissions

Related posts about copy