stderr: sudo: sorry, you must have a tty to run sudo
stderr: sudo: sorry, you must have a tty to run sudo
My new offline install of nagios xi has this error "stderr: sudo: sorry, you must have a tty to run sudo" and it wont start the httpd, crond, mysqld or ndo2db services, can someone please offer any suggestions as to how I might fix this so my services start? I attached the nagios profile. Any advice would be very much appreciated.
You do not have the required permissions to view the files attached to this post.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: stderr: sudo: sorry, you must have a tty to run sudo
Can you show the output of the following
Code: Select all
grep NAGIOS /etc/sudoers
grep requiretty /etc/sudoers|grep nagiosRe: stderr: sudo: sorry, you must have a tty to run sudo
Thanks Scott
I didnt get any result for thase commands however i did find requiretty in the sudoers file. I sthe answer to get the unix team to not set this default or change it to not require tty?
[root@caclasd05 ~]# grep NAGIOS /etc/sudoers
[root@caclasd05 ~]# grep requiretty /etc/sudoers|grep nagios
[root@caclasd05 ~]# grep requiretty /etc/sudoers
Defaults requiretty
# changed in order to be able to use sudo without a tty. See requiretty above.
I didnt get any result for thase commands however i did find requiretty in the sudoers file. I sthe answer to get the unix team to not set this default or change it to not require tty?
[root@caclasd05 ~]# grep NAGIOS /etc/sudoers
[root@caclasd05 ~]# grep requiretty /etc/sudoers|grep nagios
[root@caclasd05 ~]# grep requiretty /etc/sudoers
Defaults requiretty
# changed in order to be able to use sudo without a tty. See requiretty above.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: stderr: sudo: sorry, you must have a tty to run sudo
All of this is supposed to be in /etc/sudoers on an XI system
Code: Select all
# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service
# ASTERISK-SPECIFIC CHECKS
# NOTE: You can uncomment the following line if you are monitoring Asterisk locally
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_asterisk_sip_peers.sh, /usr/local/nagios/libexec/nagisk.pl, /usr/sbin/asterisk
User_Alias NAGIOSXI=nagios
User_Alias NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_ssl_config.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *Re: stderr: sudo: sorry, you must have a tty to run sudo
Thanks Scott. I will get this added to the sudoers file. We did try to find the nagios.sudoers file mentioned in a kb doc. Is there also any documents on what permissions the nagios user needs to have or files it is meant to own and run instead of root?
cheers
cheers
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: stderr: sudo: sorry, you must have a tty to run sudo
The file mentioned in the doc can really only be found in a source install. the details above should outline all the requirements of nagios to run as rootRLemana wrote:Thanks Scott. I will get this added to the sudoers file. We did try to find the nagios.sudoers file mentioned in a kb doc. Is there also any documents on what permissions the nagios user needs to have or files it is meant to own and run instead of root?
cheers
Re: stderr: sudo: sorry, you must have a tty to run sudo
Thanks Scott, your sudoers content fixed the running issues, I am no longer getting the errors and everything appears to be now in a running state. We will move onto setting things up to monitor and snmp traps receiving. Thanks again for all your help. This can be closed as fixed.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: stderr: sudo: sorry, you must have a tty to run sudo
great!RLemana wrote:Thanks Scott, your sudoers content fixed the running issues, I am no longer getting the errors and everything appears to be now in a running state. We will move onto setting things up to monitor and snmp traps receiving. Thanks again for all your help. This can be closed as fixed.
Locking