0

I have Jenkins running on a functional account.

Sometimes I need to run 'echo blabla' on several boxes which are accessible from a proxy server only. In that case Jenkins runs:

~/bin/sshpass -p'$userJumpServerPassword' ssh ${username}@$jumpServer  ssh root@$targetBox echo blabla

That's great, because I provide userJumpServerPassword and username and then it login to root@targetBox using private keys stored on my individual account on a proxy server. userJumpServerPassword is masked so please ignore this aspect.

The other case I'm referring to is to reach servers which are not behind a proxy. I want to do something like that:

~/bin/supass -p'$localPassword' su $username -c ssh root@$targetBox echo blabla

to force Jenkins to switch to my individual account on localhost and then use private keys to connect to target box (no password).

And here's my problem. There is no such a thing like supass allowing to use su a non interactive way. Is there any walkaround? Using ssh to connect to localhost sounds funny.

aerion
  • 702
  • 1
  • 11
  • 28

0 Answers0