Linux - Allow User to Execute SUDO Without Password
As we know, if we want to execute something and act as administrator in linux (sudo) we need to input password.
But for some of developers (including me), it is annoying, so to handle that password, we can bypass the password.
In this case, I'd like to restart nginx without me having to enter the password, these are the steps :
- Edit /etc/sudoers
sudo nano /etc/sudoers
- Add customization
add this line at the bottom of the file
username ALL = NOPASSWD: /usr/sbin/service nginx restart
- restart your nginx
And finally testing time, execute:
sudo service nginx restart