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
You need to send the password twice:
(echo 'somepassword'; echo 'somepassword') | passwd someuser