Unable to get the SSH access for a new user
Solution 1:
Check /etc/ssh/sshd_config for allowed users list. If it is OK, the problem is more complex. Try to connect as "ssh codeuser@your-server -v"
Solution 2:
Check /var/log/auth.log
for any errors. Did you assign codeuser a password using the passwd
command?
Solution 3:
On Ubuntu 18.04 I had simply neglected to add my client's public key to the authorized keys file (this post got me thinking about the authorized_keys file: https://superuser.com/a/1337741/413936).
chmod 700 ~/.ssh
cd ~/.ssh
touch authorized_keys
chmod 600 authorized_keys
Then add your client's public key to authorized_keys
file.
For whatever reason though, I didn't need to add PasswordAuthentication yes
to /etc/ssh/sshd_config on Ubuntu 18.04.3 LTS as other people have mentioned. To be clear, mine is commented out like this # PubkeyAuthentication yes
and I restarted both ssh and sshd services and was still able to ssh in.