Skip to content

Cannot execute command-line and remote command #10412

Open
@JtMotoX

Description

@JtMotoX

This issue was already discussed and reproduced in #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)

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugsshIssue in vscode-remote SSH

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions