MathematicalOrchid
MathematicalOrchid

Reputation: 62858

Visual Studio: SSH refuses to connect

If you go into Options > Cross Platform, where's an option to set up an SSH connection. However, I cannot force this thing to connect.

I have a Linux machine, I can connect to it with PuTTY just fine using password authentication. However, when I try to configure a connection in Visual Studio, it highlights the username and password boxes in red, as if there's a problem with them. I have no idea why it's not letting me log in. No matter which account I try, it just refuses. There's no diagnostic message or anything, it just highlights the fields in red.

Is there some prerequisit I'm missing? I don't understand why it won't let me connect. Is there somewhere I can look for extra diagnostic output?

Upvotes: 1

Views: 1816

Answers (1)

MathematicalOrchid
MathematicalOrchid

Reputation: 62858

OK, so it took me quite some time to figure this out. I'm writing this in case it helps anyone else...

  • Options > Cross Platform > Connection Manager is the page I was looking at, where you can set up an SSH connection. However, if you go to Options > Cross Platform > Logging and Diagnostics, you can click a button to turn on diagnostic logging. (!)

  • Once logging was turned on, VS reports:

    Renci.SshNet.Common.SshAuthenticationException: No suitable authentication method found to complete authentication (publickey,keyboard-interactive).
    

In other words, VS isn't even trying to authenticate, because none of the available methods on the SSH server match the methods VS is trying to use.

  • Long story short, it turns out password authentication is disabled on the SSH server. "What?! But I use password authentication every day to log in!" No, you do not. Apparently there is "password" authentication and "keyboard interactive" authentication, and these are somehow not the same thing. You log in using "keyboard interactive" auth, which is enabled, but VS is trying to use "password" auth, which is disabled. Once you realise this, it's perfectly obvious why you can't log in.

So, go edit /etc/ssh/sshd_config, and turn on password authentication. (In my case, there was a line that literally says PasswordAuthentication no. Change that to yes, restart the SSH daemon, VS can now connect just fine.)

Upvotes: 4

Related Questions