I need to execute a bash script as sudo on a remote linux machine from TeamCity running on a windows box. I can execute the script fine from the cmd line using plink, but I am prompted for a password. I need to be able to do this without being prompted for password in order to execute from teamcity.
What are my options?
Best Answer
You need to edit the
sudo
configuration on the host you want to run the script. Runvisudo
as root and add a line like this:USERNAME ALL=(ALL) NOPASSWD: ALL
Replace
USERNAME
with the user you want to run the script with. This should enable the user to usesudo
without entering the password. You might want to limit the use ofsudo
to the commands you actually need. Look in the sudoers by usingvisudo
for examples how to achieve that.