Skip to content

Instantly share code, notes, and snippets.

@noppolp
Created May 27, 2015 09:36
Show Gist options
  • Save noppolp/6fb88a7659c00bf4a2c5 to your computer and use it in GitHub Desktop.
Save noppolp/6fb88a7659c00bf4a2c5 to your computer and use it in GitHub Desktop.
up vote
25
down vote
accepted
After more research it seems like another (possibly better way) to answer this would be to setup the www folder like so.
sudo usermod -a -G developer user1 (add each user to developer group)
sudo chgrp -R developer /var/www/site.com/ so that developers can work in there
sudo chmod -R 2774 /var/www/site.com/ so that only developers can create/edit files (other/world can read)
sudo chgrp -R www-data /var/www/site.com/uploads so that www-data (apache/nginx) can create uploads.
Since git runs as whatever user is calling it, then as long as the user is in the "developer" group they should be able to create folders, edit PHP files, and manage the git repository.
Note: In step (3): '2' in 2774 means to 'set Group ID' for the directory. This causes new files and sub directories created within it to inherit the group ID of the parent directory (instead of the primary group of the user) Reference: http://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment