我有跳线服务器 J 和批处理服务器 B 。只能通过 J 访问 B 。我在Jenkins中使用Send files or execute command over SSH
在 B 上运行命令:
1. connect to **J** with the user/password specified in the SSH server
2. spawn ssh **B**
3. sudo su - sudouser on **B**
4. Do my work
步骤1是通过构建步骤"Send...over SSH"
实现的。步骤2到步骤4在Expect脚本文件中。在步骤2中,没有提示登录且不需要登录,服务器/登录位于.ssh/known_hosts
中。
现在,公司增加了限制,不允许在 J 上运行自定义脚本,这意味着出现了spawn ssh **B**
个错误。
我尝试在构建步骤ssh B
中将"send ...over SSH"
作为命令发送到 J 和spawn sudo - sudouser
。
它挂在ssh **B**
上,显然它正在等待登录信息(但没有提示)。
任何建议都值得赞赏。