Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 10 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
1  
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

 
discard

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.