SFTP server giving a Type 2 (protocol error) for all connections

We came across the same issue and we could solve it by eliminating all Linefeed-Characters and comments from the public key file on the CoreFTP-Server.

If you generate the key with PuTTY Key Generator, copy the pure key string into a text-file instead of using the "Save public key" button.


What client are you using for testing ? Anyway I would try doublechecking the problem with PSFTP and WinSCP.

If the error persists you might want to increase logging - there are lots of different key-checks which could've gone wrong.

A common error might include that the Hosts Key has changed. I remember CFTPS doing this daily so you might want to check your %TEMP% Directory for cftpskey.pem and see if it differs from what your clients saved. (Remember SSH doesn't like changing Hostkeys).

If I'm correct you should prevent this problem from happening by setting the cftpskey.pem to read-only. Because the keys seem already out of sync I recommand resetting the Host Cache on client-side.

For putty / psftp you will find them in the System Registry under

HKCU\Software\SimonTatham\Putty\SshHostKeys

I ran into this from the client side of a CoreFTP Server and was able to connect by telling the OpenSSH client to not try any key authentication via:

sftp -oPubkeyAuthentication=no user@url