#!/usr/bin/expect -f
set host 10.1.2.3
set user root
set password 123456
#set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
$ ssh root@10.1.2.3
root@10.1.2.3's password:
$ whereis expect
/usr/bin/expect