How to pass password as text to the 'passwd' command?
'passwd' command is used to change the user password on Linux. As a SysAdmin you may need to change/reset the user password on multiple servers in a network. As a root user you could use the 'passwd' command over ssh to do so. Generally the passwd command need new password to be supplied twice, but using --stdin option you can change the password providing new password on command line. This will also help to reduce the typo errors during changing the password.
The example command:
#echo 'newpass' | passwd --stdin user1
where : newpass is new password to be set for user user1.
Note: --stdin option can be used only by ROOT user
The example command:
#echo 'newpass' | passwd --stdin user1
where : newpass is new password to be set for user user1.
Note: --stdin option can be used only by ROOT user
Comments