I have encountered a weird problem when connecting to our FreeBSD server with FileZilla over SFTP. Either with password or key authentication I would get:
Error: Server sent disconnect message
Error: type 2 (protocol error):
Error: “Too many authentication failures”
So let’s turn on debugging shall we?
Trace: Pageant is running. Requesting keys.
Trace: Pageant has 15 SSH-2 keys
Trace: Successfully loaded 1 key pair from file
Trace: Trying Pageant key #0
Trace: Server refused our key
Trace: Trying Pageant key #1
Trace: Server refused our key
Trace: Trying Pageant key #2
Trace: Server refused our key
Trace: Trying Pageant key #3
Trace: Server refused our key
Trace: Trying Pageant key #4
Trace: Server refused our key
Trace: Trying Pageant key #5
Trace: Received disconnect message (protocol error)
Trace: Disconnection message text: Too many authentication failures
So basically, I give Filezilla a specific keyfile but it tries all my keys anyway. Now let’s see what the bright minds on FileZilla issue tracker have to say about this bug.
https://trac.filezilla-project.org/ticket/7739 gives us a workaround:
SSH_AUTH_SOCK=""; filezilla
which works nicely. A working workaround is a blessing if you really need to use someting that is essentially broken. The bug is marked as a duplicate of https://trac.filezilla-project.org/ticket/5480
This bug contains a brilliant comment by an apparent FileZilla developer:
This is by design, FileZilla uses the system’s SSH agent.
Just reconfigure the server to allow for more keys.
What the actual? The bug will apparently be solved via https://trac.filezilla-project.org/ticket/8232
which is marked as “fixed” and the comment 19 months ago says it will be in the “next version”. The latest version is 3.24.0 released on January 1st 2017 which is exactly what I have and guess what? Not fixed, after 7 years.
So at this point I’ll just safely assume that FileZilla might as well be the worst SFTP client in existence and just use something else. But guess what? There is more. The exact same problem exists in Gnome Files if you try to open an sftp:// location. The obvious reason is that Gnome Files does not ask you anything about keys or athenticaton type but just cycles through SSH keys to try and find the correct one. Why did nobody think about offering me a popup dialog to pick the correct key? Probably because Gnome likes to dumb down things, I can’t really find any other reason.