4
0
How to use cp command without to overwrite target file permissions
For example
cp /tmp/file /home/file
I dont want to change chown and chgrp on /home/file
4
0
How to use cp command without to overwrite target file permissions
For example
cp /tmp/file /home/file
I dont want to change chown and chgrp on /home/file
3
Use
cp -a
(archiving) or
cp -p
(preserve mode, ownership and timestamps)
1Isn't this exactly what is not intended? – maxelost – 2011-05-26T16:03:00.270
1@maxelost Only if the target file exists. There's two ways to interpret the question. Copy changes permissions to the user doing the copying, and that is likely not what is intented. – Daniel Beck – 2011-05-26T16:23:46.457
3
There is a better answer at ServerFault:
cp --no-preserve=all source target
1
Look at the --no-preserve option
Don't cross-post
– Sathyajith Bhat – 2011-05-26T09:39:39.943