0

我让 Jenkins 在功能帐户上运行。

有时我需要在几个只能从代理服务器访问的盒子上运行“echo blabla”。在这种情况下,詹金斯运行:

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

太好了,因为我提供了 userJumpServerPassword 和用户名,然后它使用存储在代理服务器上我的个人帐户中的私钥登录到 root@targetBox。userJumpServerPassword 被屏蔽,所以请忽略这方面。

我指的另一种情况是访问不在代理后面的服务器。我想做这样的事情:

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

强制 Jenkins 在 localhost 上切换到我的个人帐户,然后使用私钥连接到目标框(无密码)。

这是我的问题。没有像 supass 这样的东西允许以非交互方式使用 su。有没有绕道?使用 ssh 连接到 localhost 听起来很有趣。

4

0 回答 0