I have my digitalocean droplets setup so I can login to ssh via keyfiles. This works fine for the root account but if I create a secondary account via useradd
, the only way I'm able to get into the account is via su
. If I try to login with ssh using the same keyfile, I get:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
even though I added my public key to /home/user/.ssh/authorized_keys
. What to do?
This is a CentOS 7 server.
Note: I also tried adding AllowUsers exampleuser root
to /etc/ssh/sshd_config
.
Be sure to restart
sshd
after you've made changes to/etc/ssh/sshd_config
.The problem I had was that my key was of 4096 bits size and was not acceptable. I created a 2048 bits key and it worked!