#!/bin/expect -f
# Parse argument Variables
set user [lrange $argv 0 0]
set ipaddress [lrange $argv 1 1]
spawn ssh -l user ipaddress
match_max 100000
# Look for passwod prompt
set timeout 2
expect "*(yes/no)?" {
send "yes\r"
}
expect "*?assword:*"
send "password\r"
interact
expect eof
---End---
./test user 192.1.1.1
No comments:
Post a Comment