Skip to content

Instantly share code, notes, and snippets.

@paulmooring
Created November 20, 2012 17:22
Show Gist options
  • Save paulmooring/4119387 to your computer and use it in GitHub Desktop.
Save paulmooring/4119387 to your computer and use it in GitHub Desktop.
Reset password via script on ubuntu
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ cat test.sh
password="mypassword"
user="test"
echo -e "${password}\n${password}" | sudo passwd $user
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ sshpass -p 'mypassword' ssh test@127.0.0.1 "whoami"
Received disconnect from 127.0.0.1: 2: Too many authentication failures for test
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ ./test.sh
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ sshpass -p 'mypassword' ssh test@127.0.0.1 "whoami"
test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment