SchoofsKelvin / vscode-sshfs

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

Open a remote ssh terminal doesn't open #220

Closed jmekstrom closed 3 years ago

jmekstrom commented 3 years ago

I'm on a mac. When I click open a remote ssh terminal it opens briefly and I think it says the syntax of the command is wrong then closes.

SchoofsKelvin commented 3 years ago

Is there any way for you to see the full error message somewhere, e.g. in your server-side SSH logs?

What OS are you connecting to? What (default) login shell does your user use?

derfriedrich commented 3 years ago

Hi, I had the same problem on my mac (but I don´t think it is a mac specific problem). Luckily I was able to fix it by explicitly setting the shell command for my connection via SSH FS Settings->Terminal Command. In my case I had to enter /bin/bash for my server.

SchoofsKelvin commented 3 years ago

Luckily I was able to fix it by explicitly setting the shell command for my connection via SSH FS Settings->Terminal Command. In my case I had to enter /bin/bash for my server.

The only difference this makes is that it's doing /bin/bash instead of $SHELL. What OS is your server running? Does it somehow not support the $SHELL variable?

derfriedrich commented 3 years ago

Maybe it´s because it is a managed hosting server and handles ssh connections somehow special?

The specs of the server distribution are:

DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"

If I login to this server via ssh (same credentials) over a normal OS terminal the $SHELL var is set as expected:

$ env
...
SHELL=/bin/bash
...

Unfortunately if I don´t set the path of the terminal command explicitly to /bin/bash in SSH FS I just can see the vscode terminal flash up for a short time (and I think I have seen /usr/bin/bash: No such file or directory).

So somehow the $SHELL variable gets not evaluated or is not available on a connection through SSH FS and it falls back to /usr/bin/bash!?

However the workaround just works fine and maybe a hint for other users having this problem too!

Thanks Kelvin for this great and helpful extension and your support!

SchoofsKelvin commented 3 years ago

I've looked around a bit, but couldn't find any real cause for this issue:

Somehow your server makes $SHELL seemingly point at /bin/bash even though it doesn't exist, or at least isn't accessible. Which SSH service/version are you using on your server? Did you change any sshd settings?

derfriedrich commented 3 years ago

Hi Kelvin, in our server only /bin/bash exists, /usr/bin/bash does not exist.

Unfortunately I can´t help you any further with the server/sshd settings because it is a managed server. Maybe these settings prevent it from working correct!

As I said the workaround by defining /bin/bash explicitly as terminal command works just fine!

SchoofsKelvin commented 3 years ago

I'll close this issue for now then, but keep it in mind.

I was considering adding a sort of "capability detection" system for some other features, which I could also try implementing/using here to check whether $SHELL is valid, and if not, detecting an alternative.