The keys are correct and sshd is configured correctly (read all previous SO questions for this problem). Any ideas? Trying to connect from Windows with Kitty (improved PuTTy)

Ubuntu Server 20.04 x64

-rw-r--r-- 1 asdf asdf 1475 Oct 18 15:08 /root/.ssh/authorized_keys


Include /etc/ssh/sshd_config.d/*.conf
Port 22
PermitRootLogin no 
MaxAuthTries 6
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication yes
X11Forwarding yes
AcceptEnv LANG LC_*
Subsystem sftp  /usr/lib/openssh/sftp-server

Thanks in advance

  • 1
    How do you know the keys are correct? How did you copy the public key to the server? Did you apply appropriately restrictive permissions to the authorized_keys file and its parent directory? Oct 24, 2020 at 18:50
  • Copied them in 3 ways - generated by ssh, by hand and by copy/pasting them from Putty Permissions are correct
    – 1000Gbps
    Oct 24, 2020 at 19:12
  • 1
    Are you sure that you've enabled root login on the SSHd side? in Ubuntu servers, PermitRootLogin is usually either denied or set to prohibit-password so it's Key only. (You probably also should not have to SSH in as Root)
    – Thomas Ward
    Oct 24, 2020 at 20:03
  • 1
    .... even if PermitRootLogin is set appropriately, I'm not sure it's permissible for root's keys to be owned by another user (or for keys to be owned by the "wrong" user in general). OTOH if you're trying to store asdf's key(s) in /root/.ssh then I doubt that will work either Oct 24, 2020 at 20:05
  • I can't connect with normal or root user. Added SSHd config for clarity
    – 1000Gbps
    Oct 24, 2020 at 20:51

1 Answer 1


Luckily found how to fix it by accident - seems sshd cannot read from ~/.ssh/authorized_keys for unknown reason (have the same installation and configuration on another machine where passwordless ssh works).

I was forced to enter another file location in /etc/ssh/sshd_config:

AuthorizedKeysFile      /home/asdf/authorized_keys/

instead of

AuthorizedKeysFile      .ssh/authorized_keys
  • can you accept your own answer please?
    – Crighton
    Oct 24, 2020 at 22:14
  • 2
    SO system says it's possible after two days
    – 1000Gbps
    Oct 24, 2020 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.