Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Last active May 1, 2023 00:00
Show Gist options
  • Save jrichardsz/1adaaa07885b45d497b519431701a943 to your computer and use it in GitHub Desktop.
Save jrichardsz/1adaaa07885b45d497b519431701a943 to your computer and use it in GitHub Desktop.
Disable requiretty in /etc/sudoers

Disable requiretty in /etc/sudoers

requiretty setting is enabled in almost every linux systems by defaults. Enable requiretty will cause cron, scripts or process do not get tty session.

requiretty

If set, sudo will only run when the user is logged in to a real tty. When this flag is set, sudo can only be run from a login session and not via other means such as cron(8) or cgi-bin scripts. This flag is off by default.

Besides that, if you encounter error syntax like this:-

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

you can disable requiretty as well in sudoers using visudo.

Disable requiretty to particular user not to use tty.

Disable

In this file : /etc/sudoers

Change this

    Defaults:username requiretty

for

    Defaults:username !requiretty

Source

https://linuxreference.wordpress.com/2010/11/22/disable-requiretty-in-etcsudoers/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment