Change linux user default ownership on file creation? [closed]

孤人 提交于 2020-01-04 14:30:04

问题


Seems like something which should be easy to find but Googling brings up lots of unrelated tasks.

I have a deploy scipt which runs under the user "deploy" but my web server runs as "nginx" I want the web server to be able to write to the deployed files.

Ive added nginx to the deploy user group and I believe I can write files with deploy user with the ownership "nginx:deploy" easily now but by default it creates files as "deploy:deploy" obviously which nginx won't write too.

Is there anyway to change the user so that by default creates files as "nginx:deploy" to solve this problem?


回答1:


The install command has options to control the owner and group of the files it creates. But in general, only root can create files as a different user. Maybe you can configure sudoers to let the deploy user run the commands it needs with sudo as the nginx user.



来源:https://stackoverflow.com/questions/21803659/change-linux-user-default-ownership-on-file-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!