I created a new user on ubuntu 10 username: codeuser
There is an existing user called "admin". Now, my problem is that I cannot directly connect to the server using the codeuser credentials. But, I can SSH in through "admin" and then su (change the user to codeuser) and it works. How do I get the shell access to the codeuser user ?
This is the output of my files:
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/bin/bash
admin:x:1000:1000:,,,:/home/admin:/bin/bash
ftp:x:107:65534::/home/ftp:/bin/false
codeuser:x:1004:33::/home/codeuser:/bin/bash
cat /etc/group
root:x:0:
www-data:x:33:
codeuser:x:1005:
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
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"
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).
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.Check
/var/log/auth.log
for any errors. Did you assign codeuser a password using thepasswd
command?Stumble to this thread after create a new user and cannot SSH to the new user. I managed to fix it after looked for the group and user of .ssh folder and authorized_keys file. They were set to root:root, because I copied them from other user's folder with sudo.
So I fix it with:
Hope this helps
A quite old post but still valid. Worth checking logs as Marco Ramos mentioned above. In my case with Debian 9 a group must granted with permissions /var/log/auth.log
Make sure the public key is correct in this place:
Try to check /var/log/auth.log for possible error messages.
Also, ask the user to try to login with ssh -v, for more verbose output.
Hope this helps!
On new Debian installations (may be even other distributions) you have to enable password login. It started to happen recently. AllowUsers won't help you, PermitRootLogin yes won't help you.
Default configuration in /etc/ssh/sshd_config is:
but it won't let you ssh to it with plain text password. You have to uncomment it, restart sshd, insert your ssh key and comment it back or leave it enabled.