Passing input into passwd using pipe

bash, linux, passwd, pipe

Solution

You need to send the password twice:

(echo 'somepassword'; echo 'somepassword') | passwd someuser

Problem

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

Original source