SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
546 stars 36 forks source link

"Unexpected packet before version" using private key authentication #185

Closed jradwan closed 4 years ago

jradwan commented 4 years ago

When trying to connect to an SSH file system using a private key for authentication, I get this error from the extension:

Error while connecting to SSH FS <server name>: Unexpected packet before version

I've tried all the different combinations:

On the same server I have a second login with normal username/password authentication and that works fine with the extension. It just seems to be when trying to use the private key.

SchoofsKelvin commented 4 years ago

Might this be a similar issue to mscdex/ssh2-streams#121?

If it's a protocol issue, it's probably a bug in the libraries I use (ssh2 which in turn uses ssh2-streams) or a configuration/setup issue with your SSH server. Might also be related to #162 or #36, although this exact error message is unexpected.

jradwan commented 4 years ago

I figured it out. Turns out I wasn't just having this problem in VSCode but in any sFTP client using my private key. The culprit turned out to be an environment script that was added to my .bashrc. The new script was generating output when executed, displayed to stdout. This was breaking the sFTP negotiation (I guess sFTP runs login scripts like a regular SSH connection). I edited .bashrc to send that script's output to /dev/null and the connection works now. Sorry for the false alarm. :)