SSH设置socks5代理

0

由于各大运营商不同时间段出口带宽拥堵的问题,需要维护又连接不上服务器很恼火,整理一下通过代理访问SSH服务器的配置。

macOS / Linux 环境

~/.ssh/config

Host hostname
    ProxyCommand nc -x 127.0.0.1:1080 %h %p

命令行使用方法 ssh -o "ProxyCommand=nc -x 127.0.0.1:1080 %h %p" username@hostname

windows 环境

%UserProfile%\.ssh\config

Host hostname
    ProxyCommand C:\Program Files\Git\mingw64\bin\connect.exe -S 127.0.0.1:1080 %h %p

批处理中要这样使用 ssh -o "ProxyCommand=C:\Program Files\Git\mingw64\bin\connect.exe -S 127.0.0.1:1080 %%h %%p" username@hostname

发表评论

您的邮箱不会公开,当您的评论有新的回复时,会通过您填写的邮箱向您发送评论内容。 必填字段 *

为何看不到我发布的评论?

正在提交, 请稍候...