读完本文后
[root@wcmisdlin02 alexus]# tail -2 /etc/sudoers
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
[root@wcmisdlin02 alexus]#
我现在有以下内容:
[root@wcmisdlin02 ~]# cat /etc/sudoers.d/01_nagios
Defaults:nagios !requiretty
nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
[root@wcmisdlin02 ~]#
但我还是/var/log/messages
Sep 21 11:14:32 wcmisdlin02 sudo: nrpe : sorry, you must have a tty to run sudo ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/lib/nagios/plugins/check_load -w 6,5,4 -c 8,7,6
我究竟做错了什么?
答案1
确保 NRPE 以nagios
用户身份运行。
如果将其作为独立服务运行:
ps -ef | grep nrpe
grep nrpe_user /path/to/nrpe.cfg
或者如果你通过 TCP 包装器运行它:
grep user /etc/xinetd.d/nrpe