Linux下的代理命令
1
|
ssh -o ProxyCommand='nc -x xxxx:1080 %h %p' xxxx@xxx.xxx.xxx
|
Windows下
windows下虽然现在有ssh命令但是不自带nc命令
方法1
使用mobaxterm自带的nc
但是我用scoop安装的mobaxterm是portable版本并没有释放出nc的可执行文件
方法2
使用nmap的ncat命令
这里有个坑,如果安装截至撰稿最新版本7.91vscode会报错说:过程试图写入的管道不存在
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
[01:09:46.557] Running script with connection command: ssh -T -D 13100 "example.com" bash
[01:09:46.559] Terminal shell path: C:\Windows\System32\cmd.exe
[01:09:46.742] > C:\Windows\System32\cmd.exe
[01:09:46.742] Got some output, clearing connection timeout
[01:09:47.447] > kex_exchange_identification: Connection closed by remote host
[01:09:47.454] > 过程试图写入的管道不存在。
[01:09:48.732] "install" terminal command done
[01:09:48.732] Install terminal quit with output: 过程试图写入的管道不存在。
[01:09:48.732] Received install output: 过程试图写入的管道不存在。
[01:09:48.733] Failed to parse remote port from server output
[01:09:48.733] Resolver error: Error:
at Function.Create (c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:64659)
at Object.t.handleInstallOutput (c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:63302)
at Object.t.tryInstall (c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:415135)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:294918
at async Object.t.withShowDetailsEvent (c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:406463)
at async Object.t.resolve (c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:295994)
at async c:\Users\my_user\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:127:110656
[01:09:48.736] ------
|
这里只要降级nmap到7.70应该就好了
附上配置文件模板
Host x’x’x’x’x xxxxx
HostName 111.222.333.444
User xxxxx
Port 22
ProxyCommand ncat –verbose –proxy-type socks5 –proxy 127.0.0.1:1080 %h %p
感谢:https://senjianlu.com/2020/02/vscode-remote-ssh-use-proxy-with-auth/