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?

MattBianco
  • 587
  • 1
  • 6
  • 23
user27451
  • 1,151
  • 2
  • 10
  • 14

2 Answers2

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.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
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)

Nomen Nescio
  • 171
  • 1
  • 2
  • This is really great info but does not technically answer the question. – HarlemSquirrel Oct 02 '17 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 https://www.sudo.ws/stable.html – pwan Oct 04 '17 at 19:17