14 March 2013

Jenkins running shell scripts as sudo

I was getting this error:
sudo: sorry, you must have a tty to run sudo

To get Jenkins to run scripts that require sudo access, I had to do the following in the sudoer's file:
1. Fist in /etc running visudo I had to update the user Jenkins sudo's as to [user] (ALL)= NOPASSWD:ALL
2. Second I had to turn off the requiretty.  You can do t his per user, or global.

In Jenkins I added the SSH plugin and even though I'm not actually ssh'ing it seems to use this ssh user/pass/key to run sudo.  I set that ot the same host i'm on and the user i want Jenkins to use, that's in the sudoer file.

No comments:

Post a Comment