Skip to content

Instantly share code, notes, and snippets.

@hasanen
Created September 12, 2014 08:23
Show Gist options
  • Save hasanen/679e15846f2fa4404ba5 to your computer and use it in GitHub Desktop.
Save hasanen/679e15846f2fa4404ba5 to your computer and use it in GitHub Desktop.
Expect-script for automating ssh-logins without keys
#!/usr/bin/expect -f
set username [lrange $argv 0 0]
set host [lrange $argv 1 1]
set password [lrange $argv 2 2]
set timeout -1
spawn ssh $username@$host
expect "*?assword:*"
send -- "$password\r"
send -- "\r"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment