Unable to log into ssh after useradd new user
- 13 Jun 2017: Post was created (diff)
Check the journal on the target machine closely for sshd errors
root@server# useradd -m foob
root@server# journalctl -fu sshd
sshd[7693]: Invalid user foob from x.x.x.x
sshd[7673]: User foob not allowed because account is locked
sshd[7673]: input_userauth_request: invalid user newuser [preauth]
foob@client$ ssh foob@server
In my case, the account is locked because the user has no password. Create a new password for the user and try again.
root@server# passwd foob
foob@client$ ssh foob@server
If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).
Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.