10

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 ?

2 Answers 2

11

You should be able to do:

Cmnd_Alias                NOTTYCMDS = /path/to/cmd1, /path/to/cmd2
Defaults!NOTTYCMDS        !requiretty
3
  • Looks promising, but this does not work for me.
    – takeshin
    Dec 21, 2011 at 10:06
  • 2
    This works for me running Sudo version 1.7.4p5. Oct 24, 2012 at 11:30
  • I don't know why the Defaults:USERALIAS !requiretty does not work for me, but this Cmnd_Alias does, and that is good enough.
    – bgStack15
    May 31, 2017 at 15:14
5

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".)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .