Skip to content

Instantly share code, notes, and snippets.

@SpekkoRice
Last active August 29, 2015 14:03
Show Gist options
  • Save SpekkoRice/aa705fceab588a23eee8 to your computer and use it in GitHub Desktop.
Save SpekkoRice/aa705fceab588a23eee8 to your computer and use it in GitHub Desktop.
Expect Script to log into SSH
#!/usr/bin/expect -f
# Please remember to make the file executable using:
# chmod +x expectSSH.exp
#
# To run the Script simply use ./expectSSH.sh yourhost.com root password
set host [lindex $argv 0]
set user [lindex $argv 1]
set pass [lindex $argv 2]
spawn ssh $user@$host
expect "assword:"
send "$pass\r"
interact
@carstensaltus
Copy link

Simple, yet POWERFUL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment