I tried to create a user with password via ssh (with root permission) like this:
ssh firstname.lastname@example.org useradd -p $(openssl passwd -1 1234) newuser
By doing so, I could successfully create an account named
newuser, but I couldn't login with the expected password (which is
It makes no difference if I add double quotes:
ssh email@example.com "useradd -p $(openssl passwd -1 1234) newuser"
And then I was wondering if I can generate hashed password and save it as a variable locally, but still with no luck.
password=$(openssl passwd -1 1234) ssh firstname.lastname@example.org "useradd -p $password newuser"
Is there something that I miss? Thanks in advance!