2、sudo授权其它用户启动
(1)root用户编辑 visudo
root ALL=(ALL) ALL
elk ALL=(root) NOPASSWD:/etc/init.d/nginx,/usr/local/nginx/sbin/nginx
(2)切换用户启动nginx
[elk@test root]$ sudo /usr/local/nginx/sbin/nginx
[sudo] password for elk:
2、sudo授权其它用户启动
(1)root用户编辑 visudo
root ALL=(ALL) ALL
elk ALL=(root) NOPASSWD:/etc/init.d/nginx,/usr/local/nginx/sbin/nginx
(2)切换用户启动nginx
[elk@test root]$ sudo /usr/local/nginx/sbin/nginx
[sudo] password for elk: