SFTP error 382, won't connect

I'm getting a 382 error from Rubymine when trying to connect to my remote server via SFTP. I've tried with a plain password and using a SSH key, but it just won't connect using SFTP. Does anyone know what this error is and how to fix it?

I know my SSH key is good because I can login in the terminal using SSH and Cyberduck SFTP using SSH. It's just Rubymine that doesn't want to work, with or without a SSH key.

I can log in using plain old FTP, so it's just the SFTP that doesn't work.

I'm on:
OS X 10.11.2
Rubymine 8.0.3

Mark O.

Screen Shot 2016-01-10 at 2.39.16 PM.png
Comment actions Permalink

I figured out the problem so I'll explain it here.

tl;dr -  there was a problem with my known_hosts file (~/.ssh/known_hosts). I have a bunch of known hosts in this file and I noticed one line that should have been two. Basically, two hosts were listed on one line.

Here's how I figured it out:
In the Jetbrains Rubymine support section I came across the article: Enabling SSH/FTP debug logging to report problems with deployment and remote SDK configuration. I followed the steps outlined in the article to enable logging.

I found the location of the log file by doing Help > Show Log in Finder, as described in this article: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

I viewed the log file and found a line that gave more information that the useless "382".

Error during processing known-hosts file "/Users/username/.ssh/known_hosts".

I opened the known_hosts file and found the problem. Generally, the known_hosts file has each host on a separate line, similar to: ssh-rsa GJjNc/sYxEdCElG06Ub3sy5+jtqwLt4NJQBDMupG1sdnEmjU=IwEmS ssh-rsa ni2JJlFYX5d0fxQMoYYq+mODttEHKLOiHmE+PP56PcE3q6Rbvuqk+giiqSSgSe50sjx/4J0PqGN8NdIk ssh-rsa EnCt2999ba8fb2857daa03fb795feb3d9210f1dff59d3999ba8fb2857daa03fb795fezeMyYSopAAJ

I had a line that looked like: ssh-rsa ni2JJlFYX5d0fxQMoYYq+mODttEHKLOiHmE+PP56PcE3q6Rbvuqk+giiqSSgSe50sjx/4J0PqGN8NdIk128.23.70.10 ssh-rsa EnCt2999ba8fb2857daa03fb795feb3d9210f1dff59d3999ba8fb2857daa03fb795fezeMyYSopAAJ

I recognized that each IP address is the beginning of a new line. I split the incorrect line, restarted Rubymine and SSH access started working again.

I hope this helps someone,

Mark O.

Comment actions Permalink

Thanks man! 

This helped me a lot!

Comment actions Permalink

+1 This did the trick.  I had recently had to edit my known_hosts file, and apparently this resulted in the same issue: two hosts on one line.  Every other app, terminal, iterm, cyberduck, etc... all still worked fine, but PHPstorm was failing all SFTP connections.  

If it helps a future search land here, here's the line from the logs:

com.intellij.ssh.SshTransportException: Using of known_hosts file PATH_TO_KNOWN_HOSTS failed.

Comment actions Permalink

Unbelievably, I had a related issue with PyCharm failing to connect to SFTP and this fixed it. Thanks!


Please sign in to leave a comment.