Skip to content

Instantly share code, notes, and snippets.

@daoiqi
Created November 4, 2014 03:14
Show Gist options
  • Save daoiqi/42e5e6ea1f76e22fd33e to your computer and use it in GitHub Desktop.
Save daoiqi/42e5e6ea1f76e22fd33e to your computer and use it in GitHub Desktop.
自动登录ssh服务器
#!/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