VSCode远程SSH不能在非标准端口上工作



我正在尝试使用"远程ssh ";我必须通过非标准端口连接的服务器上的功能。但是,它不起作用—控制台输出显示以下内容:

[09:09:17.304] SSH Resolver called for host: foobar.example.com
[09:09:17.304] Setting up SSH remote "foobar.example.com"
[09:09:17.309] Using commit id "da15b6fd3ef856477bf6f4fb29ba1b7af717770d" and quality "stable" for server
[09:09:17.311] Install and start server if needed
[09:09:18.648] Checking ssh with "ssh -V"
[09:09:18.692] > OpenSSH_9.0p1, OpenSSL 1.1.1o  3 May 2022
[09:09:18.696] Running script with connection command: ssh -T -D 49294 "foobar.example.com" bash
[09:09:18.697] Terminal shell path: C:WindowsSystem32cmd.exe
[09:09:35.703] Resolver error: Error: Connecting with SSH timed out
…
[09:09:39.987] > ssh: connect to host foobar.example.com port 22: Connection timed

现在,我很好奇的是

这行
Running script with connection command: ssh -T -D 49294 "foobar.example.com" bash

VSCode到底在这里做什么?我需要在防火墙中打开端口49294吗?

在日志的更下面是这一行:

ssh: connect to host serv69163251-dev01.secure-node.at port 22: Connection timed

但是这行不通,因为端口应该是不同的。这是主机的配置:

Host Foobar
HostName foobar.example.com
Port 12345
User foobar
IdentityFile ~/.ssh/id_foobar

我遇到了同样的问题。我的特定ssh端口没有被使用,即使它在配置文件(Users>YOUR_USER祝辞. ssh祝辞配置)。下面是我的配置:

Host root@mydomain.com
HostName mydomain.com
Port 2299
User root
IdentityFile ~/.ssh/my_key_id_rsa

我重命名了"Host"部分到"mydomain.com";在配置文件中,保存它,它加载了正确的配置端口,SSH连接正常。

最新更新