I've been trying to configure the login with a key generated from puttygen so I can disable password authentication.

I saved a private key from puttygen and copied the public part to my .ssh/authorized_keys like so:

ssh-rsa AAAAB3Nza[...]1qRQ==

Here's what I changed in my sshd_config

AuthorizedKeysFile .ssh/authorized_keys
UsePAM no

But every time I try to login with my key the server refuses it..

enter image description here


error: key_read: type mismatch: encoding error
sshd[735]: error: key_from_blob: can't read key type
sshd[735]: error: key_read: key_from_blob
User root authorized keys /root/.ssh/authorized_keys is not a regular file

stat /root/.ssh/authorized_keys says:

68 3451018 drw------- 2 root wheel 6903510 512 "Jan 28 18:12:08 2016" "Jan 28 17:40:50 2016" "Jan 28 17:46:22 2016" "Jan 28 17:40:42 2016" 32768 8 0 /root/.ssh/.authorized_keys

Using FreeBSD 9.3

  • The "not a regular file" confuses me. What does stat /root/.ssh/authorized_keys say? Jan 28, 2016 at 18:43
  • i.imgur.com/9YsRNy5.png (hard to read in the comments) Jan 28, 2016 at 18:45
  • 3
    That looks like it's a directory? It should be a file, at least for openssh, where each line is like the one you give in your post, i.e. corresponds to one keypair. Jan 28, 2016 at 19:01
  • 1
    @JoãoMonteiro Welcome to Unix & Linux. Just a tip: when a comment asks for more information, it's best to edit the original question to add the information (as text, if at all possible) rather than putting it in a comment. This can be done even once your question has been answered.
    – depquid
    Jan 28, 2016 at 19:20
  • Did the stat command really say the name was /root/.ssh/.authorized_keys? There is a . too much in there, and I don't see how that could possibly have happened if the stat command was in fact typed without it.
    – kasperd
    Jan 29, 2016 at 9:35

2 Answers 2


As pointed out by Ulrich Schwarz, .ssh/authorized_keys must be a regular file. In your case, it looks like it's a directory. You need to remove the directory and create a single text file with the key in it.


I found the keys generated by puttygen to be troublesome in almost every attempt I made. I am not exactly sure why and how, but the format of the file it generates is not accepted by my Linux and other legacy UNIX systems.

My suggestion is, once you are on the server, generate keys using command

ssh-keygen -t rsa 

enter pass phrase if you want and file names and location too. Then append the public key generated to the end of authorized keys file. Copy (ftp or scp) private key to your PC. Open puttygen and use the import a key option. And on your putty interface, use the newly imported key.

This approach worked for me all the time

  • 1
    While key formats can be an issue, I don't think this answer is relevent because the OP shows that he used the correct key format: ssh-rsa AAAAB3Nza[...]1qRQ==
    – depquid
    Jan 28, 2016 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .