I'm trying to set my password with echo "user:SOME_PASSWORD_STRING" | sudo chpasswd -e but when I do this, my password is not set to the correct password. The passwords I'm using are one's I've copied from /etc/shadow.
Asked
Active
Viewed 4,112 times
1 Answers
2
The problem is the use of double quotes in the echo statement. The password had several $ characters in it, which was translated as bash variables.
The correct command uses single quotes:
echo 'user:SOME_PASSWORD_STRING' | sudo chpasswd -e
See here for more on quotes: Differences between doublequotes " ", singlequotes ' ' and backticks ´ ´ on commandline?