
Question:
I need to restart the nginx services installed via root using my user-id ie TAG1 without the help of sudo. Now we are using the below command to restart the Services
**COmmand : sudo /usr/bin/systemctl restart nginx**
So please provide us with some inputs how to restart nginx services using a newid without using SUDO permissions.
Answer1:<strong>Answer:</strong> Using visudo, add the following to your sudoers file, replacing username with the proper username
USER ALL = NOPASSWD: /usr/bin/systemctl restart nginx
This will allow the user to run "/usr/bin/systemctl restart nginx" with any or zero following attributes (ie. start|stop|restart).
References for more detail:
<a href="https://askubuntu.com/questions/692701/allowing-user-to-run-systemctl-systemd-services-without-password" rel="nofollow">https://askubuntu.com/questions/692701/allowing-user-to-run-systemctl-systemd-services-without-password</a>
<a href="https://serverfault.com/questions/69847/linux-how-to-give-a-user-permission-to-restart-apache" rel="nofollow">https://serverfault.com/questions/69847/linux-how-to-give-a-user-permission-to-restart-apache</a>