Passing input into passwd using pipe

11,479

You need to send the password twice:

(echo 'somepassword'; echo 'somepassword') | passwd someuser
Share:
11,479
user3667832
Author by

user3667832

Updated on June 18, 2022

Comments

  • user3667832
    user3667832 almost 2 years

    How can I pipe some input using echo, into program that requires user typing something two times?

    for example

    echo "somepassword"|passwd someuser
    

    creates this error message

    Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error
    passwd: password unchanged
    

    because I didn't retyped password