问题
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