microsoft / microsoft/vscode-remote-release

Cannot execute command-line and remote command

Open
#10,412 8 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

This issue was already discussed and reproduced in https://github.com/microsoft/vscode-remote-release/issues/481 but it looks like the issue was closed without being resolved and the issue still exists.

I have enabled remote.SSH.enableRemoteCommand and remote.SSH.useLocalServer.

Version Info:

>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631

>code --version
1.94.2
384ff7382de624fb94dbaf6da11977bba1ecd427
x64

I have configured the following in my ssh config:

Host myhost1
    RemoteCommand sudo su -
    RequestTTY yes

When I try to "Connect to host", it throws the error:

[16:35:24.158] > local-server-2> Running ssh connection command: C:\Program Files\Git\usr\bin\ssh.exe -v -T -D 6364 myhost1 bash
[16:35:24.162] > local-server-2> Spawned ssh, pid=52740
[16:35:24.221] stderr> OpenSSH_9.7p1, OpenSSL 3.2.1 30 Jan 2024
[16:35:24.544] stderr> Cannot execute command-line and remote command.
[16:35:24.547] > local-server-2> ssh child died, shutting down
[16:35:24.555] Local server exit: 0
[16:35:24.556] Received install output: local-server-2> Running ssh connection command: C:\Program Files\Git\usr\bin\ssh.exe -v -T -D 6364 myhost1 bash
local-server-2> Spawned ssh, pid=52740
OpenSSH_9.7p1, OpenSSL 3.2.1 30 Jan 2024
Cannot execute command-line and remote command.
local-server-2> ssh child died, shutting down

When I manually run the command in CMD that vsc is running, I get the same error:

>"C:\Program Files\Git\usr\bin\ssh.exe" myhost1 bash
Cannot execute command-line and remote command.

When I manually run the command in CMD without the bash command, it works and I am logged into the server as root as desired:

>"C:\Program Files\Git\usr\bin\ssh.exe" myhost1
$ id
uid=0(root) gid=0(root) groups=0(root)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.