#!/usr/bin/expect -f
if {$argc<1} {
puts stderr "Usage: $argv0 172.30.4.xx"
exit 1
}
set HOST [lindex $argv 0]
#print $HOST;
set timeout 15
spawn -noecho ssh -l hadoop 172.30.4.$HOST
# say yes to store ssh key
expect_before "no)?" {
send "yes\r" }
# send password
expect "password:"
send "hadoop\r"
#exit
interact
#------------------------------------
ssh登录 expect
最新推荐文章于 2022-11-13 12:31:00 发布