cp command change the file permission?
I use cp command to backup large file, I find that cp command change the file ower, I want to know whether cp command change the file permission or not.thanks!
|
it depends on who is copying the files. e .g
If I am userOne and I copy some file from userTwo I became the owner of that copy. |
cp --preserve
when you use cp, you are "creating" a file, so the user creating it owns it. you can have a default umask that will set permissions of a file when you create it. |
Thank you very much!
I(root user) copy a directory(dirA) including many files that have different permission and owner to another directory(dirB).I find that the files owner in dirB are changed to ROOT, I want to know if all the dirB files owner are chaged to ROOT, and the files permission in dirB are changed. I want to copy the dirB files back to the dirA in the future, if the copy change the files owner and permission , it will be a trouble. thanks! DirA------------------------->DirB (permission,fileowner changed ?) |
when using cp to backup files, it is adviceable to use cp -a, a being an option for archive, which will preserve links, permissions, ownerships, and recursively...
Cheers |
Thank you !
From myunicom |
for backing up
tar clfvzp - directory > /archivename.tar.gz when extracting tar zxvfp /archivename.tar.gz --same-owner |
All times are GMT -5. The time now is 09:17 AM. |