Restarting Apache web server by normal user (non root)

As a web developer I often have to restart apache, memcached and other services on my local or remote machines to do that usually I have to be root or use sudo and type my password to achieve that. lately I found a way to bypass typing the password for specific commands by adding the following lines into /etc/sudoers

{username} ALL = NOPASSWD: /etc/init.d/apache2
{username} ALL = NOPASSWD: /etc/init.d/memcached

by doing this I was able to run /etc/init.d/apache2 restart or /etc/init.d/memcached restart without typing the password.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>