Passwd --stdin pipe

Ed Wilts ewilts at ewilts.org
Wed Mar 24 17:25:45 UTC 2004


On Wed, Mar 24, 2004 at 12:10:57PM -0500, Jeff Graves wrote:
> I'm trying to use the passwd --stdin option to pipe a plain text
> password through passwd so it gets encrypted and set properly (since
> this is my first attempt at writing shell scripts and whatnot). Just for
> testing, I'm running this code at the command line. This is the syntax
> I'm using:
> 
> echo password | passwd --stdin username
> 
> It's says all tokens updated successfully but when I try to log in using
> the new password, I get a login incorrect. If I type:

This is what I'm using (RHL 6.2):

NEWPASSWORD=$(password-generator)
echo "Attempting to set password to $NEWPASSWORD"
echo $NEWPASSWORD | passwd --stdin $USER
(echo $NEWPASSWORD ; echo $NEWPASSWORD) | smbpasswd -a -s $USER

This has been working fine for me for several years.

-- 
Ed Wilts, Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program





More information about the redhat-list mailing list