Linux file permissions not being preserved
- by yellavon
I am deploying some custom software as root (a necessity for this situation). I set the owner/group to user1:user1 and set all the files to 644 beforehand in shell, then copy and deploy with ant. However, when files get copied over from the deployment directory, the ownership changes back to root and all the files install with 666 permissions. This seems to occur whether the file is overwritten or newly created. I believe there is a way to set an option in cp, mv commands to preserve permissions, but that would be a lot of commands to change. How can I fix this? Is there some setting I can change temporarily for root so the install always preserves the file permissions?