Created
March 1, 2015 07:05
-
-
Save shuxiao9058/f1ce87a715dc28f3e543 to your computer and use it in GitHub Desktop.
ssh autologin script
This file contains 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 | |
# ./autossh.exp user password 192.168.199.1 | |
set user [lrange $argv 0 0] | |
set password [lrange $argv 1 1] | |
set host [lrange $argv 2 2] | |
spawn ssh $user@$host | |
match_max 100000 | |
expect { | |
"continue connecting" { | |
send -- "yes\r" | |
expect { | |
"*?assword:*" { | |
send -- "$password\r" | |
} | |
} | |
} | |
"*?assword:*" { | |
send -- "$password\r" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment