sudo: Sorry, you must have a tty to run

Posted longchang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sudo: Sorry, you must have a tty to run相关的知识,希望对你有一定的参考价值。

The requiretty option in sudoers file

The requiretty if set in sudo config file sudoers, 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, shell/perl/python or cgi-bin scripts. This flag is set on many distores by default. Edit /etc/sudoers, file, enter:
# visudo
Find line that read as follows:

Defaults    requiretty

Either comment it out the line or delete the line:

#Defaults    requiretty

Save and close the file.

以上是关于sudo: Sorry, you must have a tty to run的主要内容,如果未能解决你的问题,请参考以下文章