Skip to content

Instantly share code, notes, and snippets.

@etaf
Created January 19, 2017 13:56
Show Gist options
  • Save etaf/2f53e4fe34eb19266ef52477f41a92e1 to your computer and use it in GitHub Desktop.
Save etaf/2f53e4fe34eb19266ef52477f41a92e1 to your computer and use it in GitHub Desktop.
auto_passwd
#!/usr/bin/expect
set timeout 20
set cmd [lrange $argv 1 end]
set password [lindex $argv 0]
eval spawn $cmd
expect "assword:"
send "$password\r";
interact
Put it to /usr/bin/exp, then you can use:
exp <password> ssh <anything>
exp <password> scp <anysrc> <anydst>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment