Created
July 9, 2015 01:45
-
-
Save kithokit/adcddbda29838a292fb1 to your computer and use it in GitHub Desktop.
Change Password Automatically (Ubuntu)
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 | |
# password first argument , IP second argument | |
set arg1 [lindex $argv 1] | |
set arg2 [lindex $argv 0] | |
set suffix "123!@#" | |
spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 86 ihehaadmin@$arg1 | |
expect "password:" | |
send "$arg2\n"; | |
expect "\[ihehaadmin:" | |
send "passwd\n"; | |
expect "(current)"; | |
send "$arg2\n"; | |
expect "New password:"; | |
send "$arg2$suffix\n"; | |
expect "Retype"; | |
send "$arg2$suffix\n"; | |
expect "successfully."; | |
send "exit”; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to install expect on ubuntu