LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Preserving permissions when using cp (https://www.linuxquestions.org/questions/linux-general-1/preserving-permissions-when-using-cp-82412/)

pilot1 08-15-2003 09:13 PM

Preserving permissions when using cp
 
Is there a way I can preserve the permissions of a file when I use cp to copy it?
For example, say I want to copy /var to /mnt/nd/var.
Files in /var are owned by many different people, but when I copy the files from /var to /mnt/nd/var as root, the files are all owned by root. :(

How can I make it so that I can copy files, while not changing/perserving their ownership and permissions?
Thanks!

leonscape 08-15-2003 09:17 PM

cp has a option for this, -P you can chhose which bits it preserves.

the reverse option is --no-preserve.

On most basic commands (okay nearly all console commands)

typing
thecommand --help

gives you all the options and for more detailed info try
man thecommand

pilot1 08-16-2003 05:29 AM

Thanks for your help!
I was aware that I could find it by doing "cp --help" or looking at a man page, but this was a case where I didn't have access to either of those.


All times are GMT -5. The time now is 10:05 AM.