Change linux user default ownership on file creati

2019-07-24 13:55发布

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条回答
2楼-- · 2019-07-24 14:54

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.

查看更多
登录 后发表回答