[英]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.