1
Based on the documentation here:
https://linux.die.net/man/8/adduser
I am trying to create a new user with a default home dir in Ubuntu 17.10 and specify the password:
useradd john -m -p mypassword
The user is created just fine, but if I try next to SSH to the machine using the new user with the specified password (mypassword) I get:
$ ssh john@my-host
john@my-host's password:
Permission denied, please try again.
john@my-host's password:
So why does it not work with the password I used when creating the user?
Based on below answer useradd
requires an encrypted password. From the command line I can do:
$ echo -n testpass | makepasswd --crypt-md5 --clearfrom -
testpass $1$eaXbTWAK$8flrqGzhmtWPjzRcrxWBf/
But how do I pass that to useradd
, to make it possible to do the whole thing on one line?