vscode-sshfs icon indicating copy to clipboard operation
vscode-sshfs copied to clipboard

Error - Couldn't detect the home directory for XXX_XXX_XXX_XXX

Open franklinkf opened this issue 2 years ago • 17 comments

I am trying to add a workspace folder from SSH Hosted in Windows Server. But I am getting the following error:

image

Can you please guide me how I can resolve the issue. I am using the extension for the first time.

Regards

Franklin

franklinkf avatar Mar 31 '22 05:03 franklinkf

This issue would be easier to solve with debug logs, so please follow these steps:

  • Add DEBUG_SSH2 to the sshfs.flags array in VS Code's User Settings (settings.json) e.g. "sshfs.flags": ["DEBUG_SSH2"]
    • See this issue for more information about adding flags
  • If you already have a connection open, close it completely (or even reload the window)
  • Go to Output > SSH FS and copy the log from there after replicating your bug
  • While it should censor passwords/passphrases, I recommend checking it for (other) sensitive data first. (especially since DEBUG_SSH2 activates some internal logging, which is less likely to be censored)

Besides that, what OS and version of OpenSSH (or similar) is your server running? Any special/unusual server-side config?

SchoofsKelvin avatar Apr 01 '22 21:04 SchoofsKelvin

I think i might have the same problem. It also tells me "Could not detect home directory". This is only for one server. When i try another server it seems to work great.

[INFO]    
Created output channel for vscode-sshfs
When posting your logs somewhere, keep the following in mind:
  - While the logging tries to censor your passwords/passphrases/..., double check!
    Maybe you also want to censor out e.g. the hostname/IP you're connecting to.
  - If you want to report an issue regarding authentication or something else that
    seems to be more of an issue with the actual SSH2 connection, it might be handy
    to reconnect with this added to your User Settings (settings.json) first:
      "sshfs.flags": [ "DEBUG_SSH2" ],
    This will (for new connections) also enable internal SSH2 logging.

[INFO]    Loading configurations...
[INFO]    Calculated config flags: {"debug_ssh2":[null,"Global Settings"]}
[DEBUG]   	Added configuration <censored> from [2]
[DEBUG]   	Added configuration trans from [1]
[INFO]    Found 2 configurations
[INFO]    Extension activated, version 1.24.1, mode 1
[INFO]    Command received to connect <censored>
[INFO]    [createConnection(<censored>,config)] Creating a new connection for '<censored>'
[INFO]    Calculating actual config
[DEBUG]   	Final configuration:
{
    "name": "<censored>",
    "host": "<censored>",
    "username": "<censored>",
    "password": "<censored>",
    "root": "/",
    "port": 22,
    "label": "<censored>",
    "_location": 2,
    "_locations": [
        2
    ],
    "_calculated": {
        "name": “<censored>”,
        "host": "<censored>”,
        "username": “<censored>”,
        "password": "<censored>",
        "root": "/",
        "port": 22,
        "label": "<censored>",
        "_location": 2,
        "_locations": [
            2
        ]
    }
}
[INFO]    [createSocket(<censored>)] Creating socket
[DEBUG]   [createSocket(<censored>)] Connecting to <censored>:22
[DEBUG]   [ssh2(<censored>)] DEBUG: Local ident: 'SSH-2.0-ssh2js0.4.10'
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_INIT
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_GREETING
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_HEADER
[DEBUG]   [ssh2(<censored>)] DEBUG: Remote ident: 'SSH-2.0-SshReverseProxy'
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing KEXINIT
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:508,padLen:4,remainLen:504
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXINIT
[DEBUG]   [ssh2(<censored>)] DEBUG: Comparing KEXINITs ...
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) KEX algorithms: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha1
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
[DEBUG]   [ssh2(<censored>)] DEBUG: KEX algorithm: [email protected]
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Host key formats: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Host key formats: ssh-rsa
[DEBUG]   [ssh2(<censored>)] DEBUG: Host key format: ssh-rsa
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],arcfour256,arcfour128
[DEBUG]   [ssh2(<censored>)] DEBUG: Client->Server Cipher: aes128-ctr
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],arcfour256,arcfour128
[DEBUG]   [ssh2(<censored>)] DEBUG: Server->Client Cipher: aes128-ctr
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Client->Server HMAC algorithms: [email protected],hmac-sha2-256,hmac-sha1,hmac-sha1-96
[DEBUG]   [ssh2(<censored>)] DEBUG: Client->Server HMAC algorithm: hmac-sha2-256
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Server->Client HMAC algorithms: [email protected],hmac-sha2-256,hmac-sha1,hmac-sha1-96
[DEBUG]   [ssh2(<censored>)] DEBUG: Server->Client HMAC algorithm: hmac-sha2-256
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Client->Server compression algorithms: none,[email protected],zlib
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Client->Server compression algorithms: none
[DEBUG]   [ssh2(<censored>)] DEBUG: Client->Server compression algorithm: none
[DEBUG]   [ssh2(<censored>)] DEBUG: (local) Server->Client compression algorithms: none,[email protected],zlib
[DEBUG]   [ssh2(<censored>)] DEBUG: (remote) Server->Client compression algorithms: none
[DEBUG]   [ssh2(<censored>)] DEBUG: Server->Client compression algorithm: none
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing KEXECDH_INIT
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:1116,padLen:8,remainLen:1112
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXECDH_REPLY
[DEBUG]   [ssh2(<censored>)] DEBUG: Checking host key format
[DEBUG]   [ssh2(<censored>)] DEBUG: Checking signature format
[DEBUG]   [ssh2(<censored>)] DEBUG: Verifying host fingerprint
[DEBUG]   [ssh2(<censored>)] DEBUG: Host accepted by default (no verification)
[DEBUG]   [ssh2(<censored>)] DEBUG: Verifying signature
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing NEWKEYS
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:12,padLen:10,remainLen:8
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: NEWKEYS
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: SERVICE_ACCEPT
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:28,padLen:13,remainLen:16
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
[DEBUG]   [ssh2(<censored>)] DEBUG: Client: none auth failed
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:12,padLen:10,remainLen:0
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_SUCCESS
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[INFO]    [createConnection(<censored>,config)] Remote version: SshReverseProxy
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing CHANNEL_OPEN (0, session)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN_CONFIRMATION
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing CHANNEL_REQUEST (0, exec)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:12,padLen:6,remainLen:0
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE (0)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[ERROR]   [createConnection(<censored>,config)] Error calculating ShellConfig: Error: Unable to exec
Error: Unable to exec
	at /Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:258833
	at fe.<anonymous> (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:229864)
	at fe.emit (node:events:390:28)
	at le (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:131953)
	at fe._transform (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:154542)
	at fe.Transform._write (node:internal/streams/transform:184:23)
	at writeOrBuffer (node:internal/streams/writable:389:12)
	at _write (node:internal/streams/writable:330:10)
	at fe.Writable.write (node:internal/streams/writable:334:10)
	at Socket.ondata (node:internal/streams/readable:754:22)
Caused by toPromise:
	at f (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:12794)
	at /Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16407
	at d._createConnection (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16953)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Logged at:
	at /Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16892
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async d._createConnection (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16357)
Reported by logger createConnection(<censored>,config)
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing CHANNEL_OPEN (1, session)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN_CONFIRMATION
[DEBUG]   [ssh2(<censored>)] DEBUG: Outgoing: Writing CHANNEL_REQUEST (1, exec)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: pktLen:12,padLen:6,remainLen:0
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE (1)
[DEBUG]   [ssh2(<censored>)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[ERROR]   [createConnection(<censored>,config)] Could not detect home directory
Logged at:
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Reported by logger createConnection(<censored>,config)
[ERROR]   [createConnection(<censored>,config)] Error: Unable to exec
Error: Unable to exec
	at /Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:258833
	at fe.<anonymous> (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:229864)
	at fe.emit (node:events:390:28)
	at le (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:131953)
	at fe._transform (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/14f8.extension.js:1:154542)
	at fe.Transform._write (node:internal/streams/transform:184:23)
	at writeOrBuffer (node:internal/streams/writable:389:12)
	at _write (node:internal/streams/writable:330:10)
	at fe.Writable.write (node:internal/streams/writable:334:10)
	at Socket.ondata (node:internal/streams/readable:754:22)
Caused by toPromise:
	at f (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:12794)
	at /Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:17030
	at d._createConnection (/Users/myaccount/.vscode/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:17228)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Logged at:
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Reported by logger createConnection(<censored>,config)
[INFO]    [createConnection(<censored>,config)] If this is expected, disable the CHECK_HOME flag with '-CHECK_HOME':
[INFO]    [createConnection(<censored>,config)] https://github.com/SchoofsKelvin/vscode-sshfs/issues/270

wouters avatar Apr 05 '22 21:04 wouters

@wouters It seems like your affected server runs SshReverseProxy. A quick glance at their code makes me think they don't support terminal sessions? It seems to only allow subsystem (and env and exit-signal) but not exec and shell.

SchoofsKelvin avatar Apr 12 '22 16:04 SchoofsKelvin

I'm facing this issue too - FWIW It only happens when trying to connect to Windows servers, Linux works fine. Exact error is also 'Couldn't detect the home directory for ' Is connecting to a Windows server not supported?

INFO]    Loading configurations...
[INFO]    Command received to open a terminal for FileSystemConfig(remote1)
[INFO]    [createConnection(remote1,config)] Creating a new connection for 'remote1'
[INFO]    Calculating actual config
[DEBUG]   	No privateKey, agent or password. Gonna prompt for password
[DEBUG]   	Final configuration:
{
    "name": "remote1",
    "host": "windows-host",
    "_location": 1,
    "_locations": [
        1
    ],
    "_calculated": {
        "name": "remote1",
        "host": true,
        "_location": 1,
        "_locations": [
            1
        ]
    },
    "username": "Administrator",
    "port": 22,
    "password": "<censored>"
}
[INFO]    [createSocket(remote1)] Creating socket
[DEBUG]   [createSocket(remote1)] Connecting to windows-host:22
[INFO]    [createConnection(remote1,config)] Remote version: OpenSSH_for_Windows_7.7
[ERROR]   [createConnection(remote1,config)] Could not get $SHELL from following output:
:::SHELL:$SHELL:SHELL:::

Logged at:
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async d._createConnection (/home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16357)
Reported by logger createConnection(remote1,config)
[ERROR]   [createConnection(remote1,config)] Error calculating ShellConfig: Error: Could not get $SHELL
Error: Could not get $SHELL
	at /home//.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16622
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async d._createConnection (/home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16357)
Logged at:
	at /home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16892
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async d._createConnection (/home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:16357)
Reported by logger createConnection(remote1,config)
[ERROR]   [createConnection(remote1,config)] Could not detect home directory
Logged at:
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Reported by logger createConnection(remote1,config)
[INFO]    [createConnection(remote1,config)] If this is expected, disable the CHECK_HOME flag with '-CHECK_HOME':
[INFO]    [createConnection(remote1,config)] https://github.com/SchoofsKelvin/vscode-sshfs/issues/270
[ERROR]   Error while creating terminal:
Error: Could not detect home directory
Error: Could not detect home directory
	at d._createConnection (/home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:17621)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Logged at:
	at m.commandTerminal (/home/stuieordie/.vscode-oss/extensions/kelvin.vscode-sshfs-1.24.1/dist/extension.js:11:26256)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async m._executeContributedCommand (/snap/codium/252/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:30752)

stuieordie avatar May 05 '22 12:05 stuieordie

Hi. Got next excerpt from logs:

[DEBUG]   [ssh2(somecli)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[ERROR]   [createConnection(somecli,config)] Could not detect home directory
Logged at:
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Reported by logger createConnection(somecli,config)
[WARNING] [createConnection(somecli,config)] The CHECK_HOME flag is disabled, default to '/' and ignore the error
Logged at:
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
Reported by logger createConnection(somecli,config)
[DEBUG]   [createConnection(somecli,config)] Home path: 
[DEBUG]   [createConnection(somecli,config)] Environment: []
[DEBUG]   Starting shell for somecli: cd "/bin/somecli"; /usr/sbin/cli-login
[DEBUG]   [ssh2(somecli)] DEBUG: Outgoing: Writing CHANNEL_OPEN (2, session)

After that:

[DEBUG]   [ssh2(somecli)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST (2, exit-status)
[DEBUG]   Terminal session closed: {"code":0,"status":"opening"}
[DEBUG]   [ssh2(somecli)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)

gamazind avatar May 30 '22 10:05 gamazind

This'll be quite tricky. It looks like the OpenSSH server on Windows starts a command prompt instead of a PowerShell as I expected. Not that the latter is great either, but at least it supports some sh features that the extension uses which cmd.exe doesn't support. I'll see if I can get the extension to work properly with cmd.exe, but it'll be quite tricky.

SchoofsKelvin avatar May 31 '22 19:05 SchoofsKelvin

For those having this issue when connecting to Windows OpenSSH servers (@stuieordie), this should be fixed in #338.

@gamazind Are you sure that /usr/sbin/cli-login can operate as a valid shell? And what remote server are you connecting to? I don't see the initial part of your log where it mentions e.g. the remote intent. Also, do you see any output in the terminal that gets opened?

SchoofsKelvin avatar May 31 '22 21:05 SchoofsKelvin

Hi @SchoofsKelvin Yes, I sure. It is special shell. I can connect to it from Windows 10 and Linux Debian as well using native ssh command. Remote server is server shell application on Linux Debian. I see in window text like "Connecting to [Name of connection]" and closed after. You can see report here: https://drive.google.com/file/d/12yLUEYsb3Zo78uiAZnpqD_B2avjHTAQ1/view?usp=sharing

gamazind avatar Jun 03 '22 08:06 gamazind

Based on the output your shell reported, I assume it's a Cisco router? It looks quite similar to #327, which is still an unresolved issue.

In your case, it seems like the extension is also wrongly recognizing your terminal type as PowerShell. Looks like a bug in the fallback shell detection when echo :::SHELL:$SHELL:SHELL::: fails. I'll write a patch for that right now.

SchoofsKelvin avatar Jun 07 '22 19:06 SchoofsKelvin

Hi. No, looks it is proprietary SSH

gamazind avatar Jun 07 '22 19:06 gamazind

Well, if it's a proprietary shell that doesn't fit any of the other supported shell types, it'll be quite hard to add support for it. You can try this commit's build (it's just on master branch) where the PowerShell detection is stricter now and doesn't give false positives anymore, hence the detection might fallback to regular sh shell type for your setup. _alternatively, 81d1301 also added a flag you can use as SHELL_TYPE=bash to force a certain known shell config type.

Should that work fine, it might be able to detect your home directory just fine. Otherwise, add the -CHECK_HOME and you should at least get most of the file system features, most likely along with support for remote terminals.

SchoofsKelvin avatar Jun 07 '22 20:06 SchoofsKelvin

No changes. I`ve checked current shell and SHELL_TYPE=bash (and bash with full path) as well. Additional flags that I have: "DEBUG_SSH2", "-CHECK_HOME". Same behaviour

gamazind avatar Jun 07 '22 20:06 gamazind

I'm having the same problem and my system loads powershell by default. Any resolve yet, it won't let me back in.

edb616321 avatar Jul 08 '22 00:07 edb616321

Was able to partially resolve my issue. Deleted config file and reconfigured with new user on remote system. I'm able to login without the error. The system seems to be very sensitive about the path to the remote users home directory. Also, the terminal option does not show up in the list of terminals. I have to manually reconnect it every time.

edb616321 avatar Jul 08 '22 01:07 edb616321

Sorry- Still not working. Anything on this issue?

edb616321 avatar Jul 08 '22 17:07 edb616321

Can you both post debug logs for the latest master build? To get debug logs:

  • Add DEBUG_SSH2 to the sshfs.flags array in VS Code's User Settings (settings.json) e.g. "sshfs.flags": ["DEBUG_SSH2"]
    • See this issue for more information about adding flags
  • If you already have a connection open, close it completely (or even reload the window)
  • Go to Output > SSH FS and copy the log from there after replicating your bug
  • While it should censor passwords/passphrases, I recommend checking it for (other) sensitive data first. (especially since DEBUG_SSH2 activates some internal logging, which is less likely to be censored)

The extension isn't great at handling esoteric server setups regarding weird shells, unusual file system mappings, ... and while I can try to add (limited) support for some of those, it's quite tricky.

@edb616321 What terminal option are you talking about?

SchoofsKelvin avatar Jul 12 '22 16:07 SchoofsKelvin

Couldn't detect the home directory for 'crap-plugin'

electricmessiah avatar Jul 19 '22 12:07 electricmessiah