Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am trying to allow a specific command to be run under sudo without a tty. I found that I can disable requiretty for a group :

Defaults:%support !requiretty

But I dont know how to do it for a single command. Is it possible at all ?

share|improve this question
up vote 12 down vote accepted

You should be able to do:

Cmnd_Alias                NOTTYCMDS = /path/to/cmd1, /path/to/cmd2
Defaults!NOTTYCMDS        !requiretty
share|improve this answer
Looks promising, but this does not work for me. – takeshin Dec 21 '11 at 10:06
This works for me running Sudo version 1.7.4p5. – Keith Burdis Oct 24 '12 at 11:30

To disable sudo tty requirement for a single command use the following in the sudoers file:

Defaults!/path/command !requiretty

(This is in addition to the "Defaults requiretty" line that enables the option in general. Note about the potentially confusing syntax: the first "!" just means that what follows is a command list (compare with ":" for a user list, etc), whereas the second "!" means "not".)

share|improve this answer

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.