Applications Systems

SAM Linux Script monitors that use the sudo command stop working on Red Hat Enterprise Linux (RHEL) systems that include the Defaults requiretty setting in the /etc/sudoers configuration file

This article describes workarounds for SAM Linux Script monitors that use the sudo command and stop working on Red Hat Enterprise Linux (RHEL) systems that include the Defaults requiretty setting in the /etc/sudoers configuration file. The following message may appear, "sudo: sorry, you must have a tty to run sudo".

First published date

10/15/2019 10:03 PM

Last published date

6/4/2020 5:00 AM

Overview

This article describes how to fix a SAM Linux Script monitor that includes the sudo command and stops working on RHEL systems that include Defaults requiretty in the /etc/sudoers configuration file.

The following message may appear:
sudo: sorry, you must have a tty to run sud

Product section

Server Application Monitor

Cause

The sudo command cannot be invoked without a TTY device attached.

Per a RHEL bug (© Red Hat, Inc., available at https://bugzilla.redhat.com, obtained on October 16, 2019), requiretty is no longer enabled by default in sudo-1.8.6p7-18.el7 because its impact on security is negligible and can be easily worked around. 

Resolution

Upgrade to SAM 2020.2.

Alternatively, follow these instructions:

To disable the requiretty setting in the /etc/sudoers configuration file, remove the following line:
Defaults requiretty
Alternatively, change the line to: 
Defaults !requiretty

To learn more about SAM and Linux, see: