Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using a git post-update hook to run a command via sudo, and I get the error: sudo: sorry, you must have a tty to run sudo. I believe I need to modify /etc/sudoers but I don't know how to do this. Any help would be appreciated!

share|improve this question
up vote 4 down vote accepted

If you have the line

Defaults    requiretty

in your sudoers file, comment it out.

share|improve this answer
Thanks! What exactly does this do? Could it have any unintended consequences? – Justin Meltzer Jul 13 '12 at 15:38
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. – Aaron Copley Jul 13 '12 at 15:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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