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?


From the man page of cp:

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

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

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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