How to change the user password without re-typing the passowrd
You can use the following script to change the user password as root without having to re-type the password:
This file contains 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 | |
spawn passwd [lindex $argv 0] | |
set password [lindex $argv 1] | |
expect "password:" | |
send "$password\r" | |
expect "password:" | |
send "$password\r" | |
expect eof |
I found this script helpful when called via ssh.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home