0

Here is what I have on an Ubuntu Server 16.04 LTS:

  1. I'm hosting a static website (build using https://gohugo.io/) on a private github repo
  2. I created a Webhook.php on my Webserver that is called by github ever time the repo gets a push (from https://gist.github.com/cferdinandi/e6e4e05c4b25e322db4eb1f1998523ac)

Webhook.php runs in my Nginx and shall do the following:

  1. Pull the latest changes from github
  2. Cd into the folder of the local repo
  3. Run Hugo
  4. Copy the built website to /var/www/website

My problem is that I have a mess with permissions

  1. Webhook.php runs as www-data
  2. but only my user1 currently has the ssh key to get access to the github repo
  3. Www-data is a no-login user. So I’m not really sure whether I can actually give it an SSH key.
  4. My original plan was to have the repo checked out under /home/user1/repo but this is tricky as www-data has no permissions there

In short: I’m in permission hell and I could use some suggestions on what to put where, how to adjust permissions and which direction to go int.

1 Answer 1

0

Since you are using nginx with php, I suppose you are using php-fpm, so you could setup a separate php-fpm pool running under the user you want, and then do whatever you want with the apropriate ssh identities (including the ability to interactively log in under this user), and nginx will communicate with php-fpm and thus your code via network or unix-socket.

In the same time it's perfectly normal to run ngin under www-data in Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .