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 ?

Guillaume
  • 1,063
  • 5
  • 12
  • 24

2 Answers2

11

You should be able to do:

Cmnd_Alias                NOTTYCMDS = /path/to/cmd1, /path/to/cmd2
Defaults!NOTTYCMDS        !requiretty
Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
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".)

Daniel
  • 163
  • 2
  • 11