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 in the folder with given options #221

Closed Sergeytata closed 3 years ago

Sergeytata commented 3 years ago

I would like to open a remote SSH terminal with the options allowing X forwarding. I normally use ssh -XYC username@ip. Is it possible to modify the command somewhere?

jraygauthier commented 3 years ago

Specifying -l would be a must so that remote bash is loaded as a login shell and specifying the specific path to the shell to be used. This allows for bashrc to be properly loaded with bash completions and all.

The remote ssh extension can be configured using the following remote file ~/.vscode-server/data/Machine/settings.json:

{
  "terminal.integrated.shell.linux": "/bin/bash",
  "terminal.integrated.shellArgs.linux": [ "-l" ],
}
jraygauthier commented 3 years ago

Currently, my systemd, git, etc bash auto-completions are unavailable when opening the ssh shell through the SSH FS action. These are available when manually launching ssh myuser@myhostname without any option and when opening a terminal using the remote ssh extension when configured as above.

SchoofsKelvin commented 3 years ago

Config option added in 65fa99b and added in the UI in 40e2d12: image By default it uses $SHELL as "command", which should be "The user's shell, as specified by the password database.", but which you can override. You're free to use e.g. $SHELL -l for your configs.

I've looked for this in the past, but I never found a proper answer:

  1. Does every shell support the -l option? Is it like a documented or even unspoken/undocumented rule?
  2. If that is not the case, would passing -l to $SHELL (whatever that resolves to) lead to any issues?

Since I couldn't find answer to 1. and with 2. in mind, I decided to not pass -l by default.