在没有sudo权限的情况下使用我的UserId重新启动/停止Nginx [英] Restart/Stop Nginx using my UserId without sudo permissions
问题描述
我需要在不使用sudo的情况下使用我的用户ID(即TAG1)重新启动通过root安装的nginx服务.现在,我们使用以下命令重新启动服务
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.
推荐答案
答案: 使用visudo,将以下内容添加到您的sudoers文件中,将用户名替换为正确的用户名
Answer: Using visudo, add the following to your sudoers file, replacing username with the proper username
USER ALL = NOPASSWD: /usr/bin/systemctl restart nginx
这将允许用户使用以下任意或零个属性(即,start | stop | restart)运行"/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:
https://askubuntu.com/questions/692701 /允许用户无需密码即可运行systemctl-systemd-services
https://serverfault.com/questions /69847/linux-how-to-give-a-user-permission-restart-apache
这篇关于在没有sudo权限的情况下使用我的UserId重新启动/停止Nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!