Sudo problem in automation script
Hi, I am not sure if this is technically the best place for this problem but it is within a script so maybe it is.
So I have 2 users.
First is "jenkins" second is "ninjonxb". Both of these accounts have nopassword (we are hoping to only have jenkins have nopassword if there is another way but right now they both do) and !requiretty
In my script. It will ssh into a server with the jenkins credentials. If possible also make it so when calling the ruby script mentioned below $SUDO_USER == ninjonxb not jenkins. If this isnt possible I can edit the script.
I have a script that user "jenkins" it needs to call with sudo privileges with the enviornment variables of "ninjonxb".
I tried the following but it isn't working
sudo -i -u ninjonxb sudo -E ruby scriptname
I also tried
sudo su ninjonxb -c "ruby scriptname"
but that didnt work either.
I don't have much experience with linux. This is only going to be used internally so if I need to make other edits to the sudoers file I may be able to make it. This is never hitting a production server.