2

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?

realdannys
  • 1,383
  • 1
  • 12
  • 18
  • If owner group is enough, you can set the setguid bit for the group on the folder you create the files in. YOu could get files to have `deploy:nginx` ownership with that. Not sure if you can work with that though. – Johannes H. Feb 15 '14 at 21:08
  • 1
    Off-topic. Belongs on [Super User](http://superuser.com) or [Unix/Linux SE](http://unix.stackexchange.com). – Jonathon Reinhart Feb 15 '14 at 21:11

1 Answers1

0

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.

janos
  • 120,954
  • 29
  • 226
  • 236