Best practices to avoid Jenkins error: sudo: no tty present and no askpass program specified

Posted by s g on Server Fault See other posts from Server Fault or by s g
Published on 2013-07-02T19:21:18Z Indexed on 2014/06/01 15:32 UTC
Read the original article Hit count: 231

Filed under:
|
|
|
|

When running any sudo command from Jenkins I get the following error:

sudo: no tty present and no askpass program specified

I understand that I can solve this by adding a NOPASSWD entry to my /etc/sudoers file which will allow user jenkins to run commands without needing a password. I can add an entry like this:

%jenkins ALL=(ALL)NOPASSWD:/home/vts_share/test/sudotest.sh

...but this leads to the following issue: how to avoid specifying full path in sudoers file?

I can add an entry like this:

%jenkins ALL=NOPASSWD: ALL

...but this allows user jenkins to avoid the password prompt for all commands, which seems a bit unsafe. I'm just curious what my options are here, and if there are any best practices I should consider.

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu