Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Nov 23 '12 at 4:08

This question came from our site for professional and enthusiast programmers.

To change the owner of a file/directory you use the chown command.

eg. chown :

To change the permissions of a file/directory you use the chmod command.

eg. chmod

Also look at using the -R flag to recursively change permissions of all files/folders within the given.

share|improve this answer
Thank you but I have been doing that directory by directory. What I am looking for is taking the set of known owner/permissions from one known GOOD directory tree and apply those over a 2nd BAD directory tree that accidentally had its ownership impacted ... recursively through the tree. – mcs130 Nov 23 '12 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .