linux 安裝expect
yum install -y expect
編輯腳本 expect.sh
#!/usr/bin/expect
set timeout 1
spawn ssh 10.226.3.14
expect "*password:"
send "N0IjoiIn09gjmP59gjm532f01b1\r"
interact
另一個方法:
yum -y install sshpass
#!/bin/bash
sshpass -p 'N0IjoiIn09gjmP59gjm532f01b1' ssh -p 22 root@10.226.3.14
搞定。