I want to add a new user to my CentOS 6 server (let's call him Barry). I've made the user account Barry and added him to a group I created called webusers like this:
groupadd webusers
useradd -G webusers Barry
passwd Barry
Now that I have a user account all set up with a password and added to a group, I want to give the group permission to write to the nginx config file, restart nginx, and do whatever they need to do in /var/www/ like create files/directories etc.
The nginx config file is located here:
/webservers/nginx/conf/nginx.conf
To restart nginx, I want the webusers group to be able to run the following command:
/etc/init.d/nginx restart
And I want to give them permissions to read and write to this directory:
/var/www/
chmod looks horribly confusing to me, I've never had to use it before and I'm kinda new to system administration.
Best Answer
For the nginx conf file, simply make it group writable:
To allow the webusers group to restart the service, it'll be easiest to do this with
sudo
. If it's not installed, install with (as root):Then edit /etc/sudoers with:
Add some entries like:
This will allow members of the webusers group to run the command
sudo service nginx restart
.For /var/www you'll need to add group write and add the setgid bit to the directory to ensure new files have group webusers: