Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to copy files from one place to another, I am using this:

cp -R /from/ /to/

However, whilst this is keeping the standard permissions, it is setting the group permissions to 0 0 (Owner/Group).

How can I copy the files over whilst keeping the correct permissions?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

From the man page of cp:

   -p     same as --preserve=mode,ownership,timestamps

   --preserve[=ATTR_LIST]
          preserve the specified attributes (default: mode,owner‐
          ship,timestamps),  if  possible  additional attributes:
          context, links, xattr, all

So, cp -Rp /from/ to/ should work.

share|improve this answer
    
Thanks very much! –  Brett Apr 17 '13 at 18:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.