Linux file permissions not being preserved

Posted by yellavon on Super User See other posts from Super User or by yellavon
Published on 2012-07-10T14:13:54Z Indexed on 2012/07/10 15:18 UTC
Read the original article Hit count: 304

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?

© Super User or respective owner

Related posts about linux

Related posts about permissions