I need a script for changing root password. After some investigation I found follow command:
echo "pass\npass" | passwd root
I checked it on Ubuntu, and it works, but....
My target is embedded linux, and when I execute this command on device, it does not work. The message is:
Changing password for root
Passwords don't match
passwd: password for root is unchanged
I suppose, that all string with passwords is read as a password for first request (New password
, and for the second request (Retype password
, nothing remains.
Does someone have any idea, how to fix it?