Created
November 4, 2014 03:14
-
-
Save daoiqi/42e5e6ea1f76e22fd33e to your computer and use it in GitHub Desktop.
自动登录ssh服务器
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 | |
#自动登录服务器 | |
set ip [lindex $argv 0] | |
set password "this is password" | |
set timeout 10 | |
spawn ssh root@$ip | |
expect { | |
"*yes/no" { send "yes\r"; exp_continue} | |
"*assword:" { send "$password\r" } | |
} | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment