Linux/Nagios: sudo: sorry, you must have a tty to run sudo

From: http://kb.initso.at/2011/05/linuxnagios-sudo-sorry-you-must-have-a-tty-to-run-sudo/

Problem description:

If you are using Nagios or other monitoring products to check your servers, you might come into the situation running commands which require special permissions (e.g. like running them as the root-user). You have configured sudo permissions and your check runs fine on the terminal, but if the monitoring process/service tries to execute it, you are receiving the following message:

sudo: sorry, you must have a tty to run sudo

Cause:

By default sudo only allows to be executed with a tty:

[root@linux01 ~]# cat /etc/sudoers | grep requiretty
Defaults requiretty
[root@linux01 ~]#

Problem resolution:

You can either disable requiretty or just disable it for the user you require to use sudo without tty (PREFERRED):

[root@linux01 ~]# cat /etc/sudoers | grep requiretty
Defaults requiretty
Defaults:myosuser !requiretty
[root@linux01 ~]#

Advertisements

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s