I've been trying to set up a new user on my Arch Linux system by way of a simple shell script, following the advice of several sources which state that printf "$password\n$password\n" | (passwd $user)
, or similarly echo -e "$password\n$password\n" | (passwd $user)
should do the trick.
In doing so, however, while it does succeed and report that the password has been updated, trying to log in via ssh with that user doesn't work for some reason. Does anyone know why, and how to fix it?
I have tried removing the variables, and simply make the password and user static text as well. The exact same lines of commands; printf "123abcXYZ\n123abcXYZ\n" | (passwd dummy)
works in the shell and I can log in via ssh, but take the same line and put it in a script and it will say the password is wrong.
Any ideas?