Tuesday, September 18, 2012

Auto login with interaction - spawn(expect)


Require Package: expect-5.44.1.15-2.el6.x86_64

-----------------------
login.sh:
-----------------------
#!/usr/bin/expect -f
log_file expect.log #log the process
set timeout 3
spawn ssh "root@8.8.8.8"
expect "assword"
send "password\r"
#spawn ls
interact #Do not leave after spawn login

No comments:

Post a Comment