Is it possible to use sudo with !requiretty for a specific command

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 ?


You should be able to do:

Cmnd_Alias                NOTTYCMDS = /path/to/cmd1, /path/to/cmd2
Defaults!NOTTYCMDS        !requiretty

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