sshfs-win-manager icon indicating copy to clipboard operation
sshfs-win-manager copied to clipboard

Process Timeout: Couldn't connect to 'abc'

Open seahindeniz opened this issue 4 years ago • 19 comments

Hi, I'm trying to connect with the correct credentials that I'm already using it to connect a server via ssh

image

However, this is what I get after clicking the connect button: image

And here is the Debug output panel: image

  • Is there a way to solve this connection timeout problem?
  • Is it possible to track this issue?
  • Can the app show more information on the Debug panel about what's going on in the app in future?

seahindeniz avatar Jun 14 '21 11:06 seahindeniz

Hello,

I use to connect to EC2 instances all the time, and when I got this message, usually is related to the instance security group. Check if your security group allows connection to SSH.

evsar3 avatar Jun 14 '21 14:06 evsar3

Yeah, I already did, and I think I shouldn't connect to SSH from command line if I had security policy related issues 🤔

seahindeniz avatar Jun 14 '21 14:06 seahindeniz

I see... what about Windows firewall settings? Create an outgoing rule to allow connection for C:\Program Files\SSHFS-Win\bin\sshfs.exe

evsar3 avatar Jun 14 '21 14:06 evsar3

I have created new rules for inbound and outbound connections from SSHFS just to be sure it doesn't get restricted by any reason however, didn't work either. Inbound: image

Outbound: image

seahindeniz avatar Jun 14 '21 15:06 seahindeniz

Sorry Sahin but I'm out of ideas. Let's hope someone on the community could take us to a fix for this.

evsar3 avatar Jun 14 '21 16:06 evsar3

Hello @seahindeniz , did you managed to fix this?

evsar3 avatar Sep 21 '21 16:09 evsar3

I have stop finding a solution after a while later and didn't confirm recently. Not sure if it's working now

seahindeniz avatar Sep 21 '21 17:09 seahindeniz

I have the same issue, it was working and suddenly stopped it happens with v1.3.0-beta.1, with v1.2.1 i can see debug output

but now i have another problem stderr: Load key ".../ssh/mykey": invalid format

I am using same key as i use for Putty and it works fine

ramaxa9 avatar Sep 27 '21 20:09 ramaxa9

I'm having the same issue as the OP, except that I'm using a local server. When using an SSH key I'm seeing nothing in debug output, but when I use a password I see debug output. When attempting to use password, I see this:

--------------------------------------------------------------------------------
date: 2021-09-28T12:27:18.914Z
conn: {0912b0d3-bd18-4727-9bf4-5ff780c90dda} (Magneto)
conntype: password-ask
cmd: "C:\Program Files\SSHFS-Win\bin\sshfs.exe" [email protected]:/ E: -p22 -ovolname=Magneto -odebug -ologlevel=debug1 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oidmap=user -ouid=-1 -ogid=-1 -oumask=000 -ocreate_umask=000 -omax_readahead=1GB -oallow_other -olarge_read -okernel_cache -ofollow_symlinks -oPreferredAuthentications=password -opassword_stdin
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: SSHFS version 3.7.1
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-oPort=22> <-ologlevel=debug1> <-oStrictHostKeyChecking=no> <-oUserKnownHostsFile=/dev/null> <-oPreferredAuthentications=password> <-oNumberOfPasswordPrompts=1> <-2> <[email protected]> <-s> <sftp>
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: debug1: Connecting to 192.168.1.16 [192.168.1.16] port 22.
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: debug1: Connection established.
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_rsa type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_rsa-cert type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_dsa type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_dsa-cert type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_ecdsa type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_ecdsa-cert type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_ecdsa_sk type -1
debug1: identity file /cygdrive/c/Users/Offspring/.ssh/id_ecdsa_sk-cert type -1
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: debug1: Server host key: ecdsa-sha2-nistp256 SHA256:RbdokQYCvDI1BZ4chN5tSquTAFOYqtBJBZkU2JHMo+4
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} stderr: read: Connection reset by peer
{0912b0d3-bd18-4727-9bf4-5ff780c90dda} exit: 1

Which is expected, since I only allow pubkey, but when I attempt to use pubkey it errors out telling me that it timed out when I use C:\Users\Offspring\Documents\SSH\id_rsa.magneto (filename).

If, however, I use C:\Users\Offspring.ssh\id_rsa then it connects just fine, so it seems like there's a bug with trying to use authkeys and filenames other than id_rsa.

Quick edit: I attempted to use magneto_id_rsa and that ALSO threw a connection timeout and failed to load, so I can only use id_rsa, which means that I can only mount one remote share using sshkeys.

BRTPOB avatar Sep 28 '21 12:09 BRTPOB

@evsar3 to add to my above, manually pathing to the id_rsa file also fails with no debug output and an error of timing out. I asked a friend to help look into it, and he thinks this method is the culprit as, according to him "showOpenDialog returns as a promise, not a single path. If he resolves the promise and look at its filePaths property, use the first value if it exists. He can either change it to use showOpenDialogSync which isn't a promise, but he's still treating the result as a single path instead of an array of paths that it actually is - or he can use the promise api and interrogate the result."

https://github.com/evsar3/sshfs-win-manager/blob/8e76aab1b5a9eb35a4c57e3d756318d02f1b1c6a/src/renderer/components/AddEditConnectionWindow/index.vue#L140-L151

BRTPOB avatar Sep 28 '21 13:09 BRTPOB

Hi @BRTPOB! The "open dialog" is by itself a modal system window. The execution of the code stops in the moment it open and is resumed when the dialog is closed. This functions seems to be working properly, once the path of the chosen file appears on the input field.

SSH is always complicate to debug because it sometimes don't show any error at all and the error is a generic message. I attached the sshfs.exe process with the debug option (which is not recommended) in the hope to get more useful error messages.

evsar3 avatar Sep 28 '21 14:09 evsar3

Try checking the file permissions of your key files.

Try running the manager as Administrator. If it works, you may have file permission issues.

evsar3 avatar Sep 28 '21 14:09 evsar3

Try checking the file permissions of your key files.

Try running the manager as Administrator. If it works, you may have file permission issues.

I just checked permissions, and they're fine. My local user is the owner, and I can read/write them just fine. Running as Admin produced almost all of the same issues, except now I'm not getting a "Connection timed out" error, I'm just not getting an error at all.

BRTPOB avatar Sep 28 '21 14:09 BRTPOB

Hi @BRTPOB! The "open dialog" is by itself a modal system window. The execution of the code stops in the moment it open and is resumed when the dialog is closed. This functions seems to be working properly, once the path of the chosen file appears on the input field.

Unless I'm misreading the documentation, showOpenDialog returns a Promise<Object> which itself has the file path inside filePaths as an array. Code execution may or may not be paused as it's an async method, but the result isn't available until the promise is resolved.

You might be thinking of showOpenDialogSync which does block execution, but it still returns String[] and not String - you need to use the first value, not the whole result. When toString'd it might look ok in the field, but @BRTPOB couldn't get the application to work after browsing to id_rsa (the default value) - it works when it's a default, it fails when it's selected via this dialog.

An example of switching to showOpenDialogSync:

    selectPrivateKey () {
      const file = remote.dialog.showOpenDialogSync({
        title: 'Select private key',
        properties: ['openFile'],
        defaultPath: process.env.USERPROFILE + '\\.ssh\\'
      })
      if (file && file.length > 0) {
        this.conn.keyFile = file[0]
      }
    }

Dinnerbone avatar Sep 28 '21 14:09 Dinnerbone

Didn't realize the electron version was so old - you're right that showOpenDialog is the sync method in this old version, but the result is still an array.

Dinnerbone avatar Sep 28 '21 16:09 Dinnerbone

@seahindeniz A new version was built yesterday, and it should fix your issue as I saw the same thing but I don't have any .pems to test against, so if that fails it's something specific with the .pems but otherwise it works for me.

BRTPOB avatar Sep 29 '21 21:09 BRTPOB

@seahindeniz is your key generated by PuTTY? If so, this should be the problem. PuTTY has a tool to convert keys. Usually OpenSSH keys don't have ".pem" extension.

evsar3 avatar Sep 30 '21 00:09 evsar3

Not sure if this is right thread...

i can mount w/o passphrase but not with passphrase

stderr: debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: No more authentication methods to try.
xxx@xxx: Permission denied (publickey).
read: Connection reset by peer
exit: 1

sshfs-win-manager v1.3.1

ramaxa9 avatar Oct 08 '21 18:10 ramaxa9

That's a different issue, @ramaxa9.

BRTPOB avatar Oct 08 '21 18:10 BRTPOB