Piping a password to passwd

James Robertson jwrober at linuxfromscratch.org
Wed Jan 26 11:23:17 PST 2005

Jeremy Huntwork wrote:
> Michael Kipper wrote:
>>I'm not sure if this is a -dev question, but here goes:
>>I build my LFS by scripts, and am having trouble automating the password
>>portion. I think the following should work:
>>yes "myr00tpassword" | passwd root
>>But it hangs at the console, waiting for input:
>>root at localhost:/# yes "myr00tpasswd" | passwd root
>>Changing password for root
>>Enter the new password (minimum of 5, maximum of 127 characters)
>>Please use a combination of upper and lower case letters and numbers.
>>New password:
>>Why is this? Is there a 'proper' way to do this?
<snip expect code>

Well everyone may have thought your script overkill,but is was a neat 
lesson in expect!


> --
> Jeremy Huntwork

James Robertson -- jwrober at linuxfromscratch dot org
Reg. Linux User -- #160424 -- http://counter.li.org
Reg. LFS User   -- #6981   -- http://www.linuxfromscratch.org
LFS Bugzilla Maintainer    -- http://{blfs-}bugs.linuxfromscratch.org

More information about the lfs-dev mailing list