I have an ubuntu server. On this server runs an apache2 with php and MySQL. I am the admin of this server but I have a person, who is the admin of the apache2-server. I know, that you can't create a second root account, but this second admin needs rights to create new vhosts or activate apache mods. How could I do this, that this second admin can work on apache without root rights?



In the sudoers file, You can allow them to sudo run certain commands as certain users.

ie. taken from the linked help

dgb boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm

Then user dgb is now allowed to run /bin/ls as operator, but /bin/kill and /usr/bin/lprm as root.

You will need to find the applications that he will need to be able to run. ie. /etc/init.d/apache2

dgb boulder = (root) /etc/init.d/apache2 plus other commands that they might need to run

Suders Help

Also you will probably need to add them to a group that has write access to the sites-enabled site-avaliable folders so that they can edit the config files.


Add your second admin to the "admin" group:

sudo usermod -a -G admin userName

Also make sure that the /etc/sudoers file has the following line:

%admin  ALL=(ALL)   ALL

This allows people in group "admin" to run any and all commands by prepending them with "sudo" as this:

sudo edit /etc/apache2/apache2.conf
sudo service apache restart
  • Note that admin group is deprecated in favour of group sudo for this purpose..it is only kept for backward compatibility.. – heemayl May 14 '15 at 22:27
  • Which password will have this user type in when he want to run this comands? His normal password or my sudo password? – ssd_rider May 16 '15 at 9:48

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.