Created
December 30, 2013 03:50
-
-
Save airekans/8177594 to your computer and use it in GitHub Desktop.
A script used to login remote machine without human interaction by using expect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/expect -f | |
set host [lindex $argv 0] | |
set user [lindex $argv 1] | |
set pwsd [lindex $argv 2] | |
spawn ssh $user@$host | |
expect "yes/no" { | |
send "yes\r" | |
expect "?assword:" { send -- "$pwsd\r" } | |
} "?assword:" { send -- "$pwsd\r" } | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment