Saturday, August 1, 2009

Changing password via a script - The solution

Changing password via a script - The solution: "Changing password via a script
Bookmark Bookmark & Share
Last update on October 29, 2008 06:44 AM by jak58
Published by jak58

Changing password via a script

*
o Method 1: passwd
o Method 2: chpasswd




Method 1: passwd

Conventionally the command use to change password on Linux based system is passwd
, the option related to this command is รข€“stdin ,an this is all done throughout a pipe.

echo -e 'new_password\nnew_password' | (passwd --stdin $USER)


Method 2: chpasswd

Another alternative is to use the chpasswd, explain as below:

echo 'password:name' | chpasswd



Note that the first method can be use to change psssword on Samba based system:

echo -e 'new_password\nnew_password' | (smbpasswd -a -s $USER)"

No comments:

Post a Comment