sudo nrpe sorry you must have a tty to run sudo

6,853

Make sure that NRPE is running as nagios user.

If you run it as a standalone service:

ps -ef | grep nrpe
grep nrpe_user /path/to/nrpe.cfg

Or if you run it via TCP wrapper:

grep user /etc/xinetd.d/nrpe
Share:
6,853
alexus
Author by

alexus

Consulting | alexus.biz Dmitry Chorine | LinkedIn a1exus (a1exus) on Twitter Verify a Red Hat Certified Professional | redhat.com

Updated on September 18, 2022

Comments

  • alexus
    alexus almost 2 years

    After reading this

    [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]# 
    

    I now have following:

    [root@wcmisdlin02 ~]# cat /etc/sudoers.d/01_nagios 
    Defaults:nagios !requiretty
    nagios      ALL=(ALL)   NOPASSWD:   /usr/lib/nagios/plugins/
    [root@wcmisdlin02 ~]# 
    

    yet I'm getting in my /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
    

    What am I doing wrong?

  • alexus
    alexus almost 13 years
    you were right, new nagios's nrpe now uses nrpe user instead of nagios user, so as soon as i changed nagios to nrpe it start working right away, thanks!
  • alexus
    alexus almost 13 years
    @voretaq7 I was trying to do so, it wouldn't allow me to do so, it said it was too soon, i gotta wait for 2 minutes, so now after 2 minutes later i accept it as an answer
  • voretaq7
    voretaq7 almost 13 years
    ah, I forgot about that timeout :-)