Created
March 10, 2020 00:16
-
-
Save rangerz/9e83514acf32ec4b094d0f16ce618ff8 to your computer and use it in GitHub Desktop.
SSH with Password Parameter
This file contains hidden or 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 | |
# Install for MacOSX | |
# brew install expect | |
# touch /usr/local/bin/exssh | |
# chmod +x /usr/local/bin/exssh | |
set timeout 30 | |
set userhost [lindex $argv 0] | |
set password [lindex $argv 1] | |
spawn ssh $userhost | |
expect { | |
"(yes/no)?" | |
{send "yes\n";exp_continue} | |
"password:" | |
{send "$password\n"} | |
"Password:" | |
{send "$password\n"} | |
"*#" | |
{} | |
"*$" | |
{} | |
"*~" | |
{} | |
} | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment