天天看點

利用shell腳本通過ssh繞過輸入密碼直接登入主機

shell

#!/usr/bin/expect
spawn ssh [email protected]
expect "*password:"
send "lizhenghua\r"
expect "*#"
interact      

需要安裝expect, 如果執行失敗

yum install expect -y      

轉載于:https://www.cnblogs.com/chenglee/p/9024977.html