2025-05-20 01:20:32 +08:00

19 lines
264 B
Plaintext

#!/usr/bin/expect
set port [lindex $argv 0]
set ip 172.29.118
set hosts /home/daya/.ssh/known_hosts
spawn rm $hosts
set timeout -1
spawn ssh root@$ip.$port
expect {
"yes/no" {send "yes\r"}
}
set timeout 3
expect {
"password" {send "root\r"}
}
expect eof