vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

"Remote - SSH" extension 0.66 doesn't respect RemoteCommand in SSH config

Open likan999 opened this issue 5 years ago • 6 comments

  • VSCode Version: 1.61.2
  • Local OS Version: OSX 12.0.1
  • Remote OS Version: Ubuntu 20.04.3
  • Remote Extension/Connection Type: SSH
  • Logs:

Steps to Reproduce:

  1. Add a host to .ssh/config with section RemoteCommand.
  2. Connect to the host using VSCode.
  3. One should expect RemoteCommand is used, but it wasn't. Before 0.66, it worked, but now it is not. This completely breaks my workflow.

Does this issue occur when you try this locally?: N/A - this is all about how SSH connection is made Does this issue occur when you try this locally and all extensions are disabled?: N/A

likan999 avatar Nov 03 '21 06:11 likan999

Hey @likan999 thanks for letting us know quickly. What does your config look like? And just as a sanity check are you able to connect to your host through terminal?

tanhakabir avatar Nov 03 '21 16:11 tanhakabir

My use case is to SSH into remote server and immediately enter toolbox, so the config is

Host xxx
  ....
  RemoteCommand toolbox run -T bash

By ssh to this host, it automatically enters the toolbox, which has all necessary development tools. In previous version 0.65.8, it works perfectly; now it ignores the RemoteCommand directive in ssh config.

I looked a little deeper into the cryptic extension.js of this extension (I don't think it is open source, isn't it?), all it is due to this piece of code:

i=await d.getConfigurationForHost(e),a=(null==n?void 0:n.quoteForShell)||!1;return["-T",...o,s,...w(i),...v(i),...await _(a,e,t),...S(e),y(e,a)].filter((e=>!!e))}function v(e){return e&&e.RemoteCommand?["-o","RemoteCommand=none"]:[]}

The logic here is if the configuration has RemoteCommand directive, it appends -o RemoteCommand=none to the ssh so force it ignore this directive.

In previous version this piece of code exists as well, but in my config, the RemoteCommand directive is in another config file, which is included using an Include directive, and my guess is in previous versions, it doesn't parse the included file, but in 0.66.0, it does, which causes -o RemoteCommand=none to be added and breaks my workflow.

This RemoteCommand is very useful, and I'm not the only one that needs it: see https://github.com/microsoft/vscode-remote-release/issues/4474. Please add it. I understand there is a concern RemoteCommand doesn't work in general, but there are cases it is needed, so why not add an option in preferences, namely "Allow RemoteCommand". By default it is false, which is the current behavior; when it is enabled, it will not append the -o RemoteCommand=none, and the description of the option could include a warning saying user needs to know what they are doing and things might break, users are on their own.

likan999 avatar Nov 07 '21 17:11 likan999

Wow thank you for the detailed inspection! You're right that we are overriding RemoteCommand with none to force ssh to ignore it. The issue is if we allow RemoteCommand we won't be able run a script on your remote to install and start VS Code on your server.

For this reason we ignored RemoteCommand in https://github.com/microsoft/vscode-remote-release/issues/481 where we needed to silence. If you could upvote https://github.com/microsoft/vscode-remote-release/issues/4474 I can inspect this issue later this month.

Something I am confused about is how did RemoteCommand work for you before if we weren't including that host and you wouldn't have been able to connect to that host?

tanhakabir avatar Nov 08 '21 16:11 tanhakabir

Going to close this issue since it's a duplicate of https://github.com/microsoft/vscode-remote-release/issues/4474 by the way!

tanhakabir avatar Nov 08 '21 19:11 tanhakabir

@tanhakabir Are you sure it's a duplicate? OP said that problem started with 0.66. #4474 was opened in February, so long before 0.66

I didn't track extension version, but I configured RemoteCommand in April and I believe it was working a few months.

mak3 avatar Dec 11 '21 18:12 mak3

@mak3 we overruled RemoteCommand to be none in this issue: https://github.com/microsoft/vscode-remote-release/issues/481#issue-449402872

I'm not sure when it was noticed or how often everyone keeps their extensions up to date so I can't say why it was only submitted in February but I'm confident this issue is a duplicate of that one.

tanhakabir avatar Dec 12 '21 01:12 tanhakabir