Skip to content

Instantly share code, notes, and snippets.

@rtacconi
Created November 13, 2011 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtacconi/1362404 to your computer and use it in GitHub Desktop.
Save rtacconi/1362404 to your computer and use it in GitHub Desktop.
How to change a user password as root with expect
#!/usr/bin/expect
spawn passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment