Restart/Stop Nginx using my UserId without sudo permissions


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.


<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>


  • how to run cmd as root from apache (centOS)?
  • Oracle Rest Data Service (ORDS) URL link
  • Postgres - Pull a copy of an entire DB from a remote server, to local dev machine
  • Nginx: Permission denied to Gunicorn socket on CentOS 7
  • How start apache in centOS 7
  • docker-machine create with digitalocean driver: ssh command error
  • How to get the IDENTITY value when using INSERT … OUTPUT with pyodbc
  • How to get a part of id element using jQuery?
  • Capistrano + thin + nginx with user not allowed to sudo howto?
  • Store the result of a stored procedure without using an output parameter
  • SQL Server how to maintain GUID across tables in same DB
  • “ModuleNotFoundError: No module named ” in my Docker container
  • How to install dependencies while creating a .deb installer?
  • Permission Denied when executing python file in linux
  • Is need install mysql on AWS EC2 if i am using AWS rds as database instance?
  • Maintaining a reliable session in express
  • How to implement HTTPS in laravel 5.4
  • mysql auto kill query
  • Error while installing ggplot in python
  • How do I run my Specs with the previous version of Rspec?
  • Implementing HMAC-SHA256 for Keybase in Javascript
  • missing pie chart and other elements when display serenity report from jenkins
  • Using docker environment -e variable in supervisor
  • Efficient & Pythonic way of finding all possible sublists of a list in given range and the minim
  • Recording values of radio buttons in ember
  • Write output of for loop to multiple files
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • nodemcu custom firmware build problems
  • Android Studio Can't Find tools.jar
  • Convert SQLite database to XML
  • cygwin cannot exec 'git-add--interactive' permission denied
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Eclipse CDT error: Unable to compile
  • Zurb Foundation _global.scss meta styles for js?
  • error importing numpy
  • Join two tables and save into third-sql
  • How to make Safari send if-modified-since header?
  • Matrix multiplication with MKL
  • Android Google Maps API OnLocationChanged only called once
  • UserPrincipal.Current returns apppool on IIS