[英]Non-interactively ssh to server but interactively
我以这种方式理解使用ssh的所有安全风险,但我现在需要的是一些能够登录到target
服务器并执行foo命令并返回源主机的一行(bash)shell脚本, 就像是:
while true
do
ssh target foo # Here I get the prompt for a password which
# I would like to give non-interactively
sleep 1
done
我不想使用基于ssh密钥的身份验证,因为我真正需要的是每秒模拟一次(或左右)交互式登录过程(但不是交互式!)。
sshpass旨在以编程方式提供ssh的密码,而不是以交互方式提供。 所以,你可以替换ssh target foo
例如通过sshpass -f passwordfile ssh target foo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.