79

I don't want to comment out the line in /etc/sudoers:

Defaults    requiretty

Instead, I only want a certain user not to require a tty. How can this be done?

2 Answers 2

96

You said that you want one particular user to not require a tty. That's the default behavior. Nevertheless, you can explicitly set that like this:

Defaults:username !requiretty

If you want everyone else to require a tty, then you'll have to uncommment the line.

2
6

RedHat now recommends removing 'Defaults requiretty', conforming with the source code defaults. In Security Advisory RHSA-2016:2593, Redhat patched /etc/sudoers, removing line 'Defaults requiretty'

For additional details, see: https://bugzilla.redhat.com/show_bug.cgi?id=1196451 https://bugzilla.redhat.com/attachment.cgi?id=1155247&action=diff

Also, per user requiretty exceptions DO NOT WORK for RHEL/CENTOS 7 (sudo 1.8.6p7)

2
  • This is really great info but does not technically answer the question. Oct 2, 2017 at 15:24
  • 2
    Do you have a link to a ticket about per user defaults not working on RHEL/CENTOS 7 ? Or maybe a link to release notes saying this has been fixed post 1.8.6p7 ? I'm not seeing anything about it under sudo.ws/stable.html
    – pwan
    Oct 4, 2017 at 19:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.