ssh 作为 socks 代理-通道 5:打开失败:连接失败:连接被拒绝

ssh 作为 socks 代理-通道 5:打开失败:连接失败:连接被拒绝

我使用 ssh 作为 socks 代理时遇到了困难。

一些细节...我使用 yakuake 连接到远程主机

ssh [email protected] -D5902

我也在浏览器中使用 127.0.0.1:5902 作为我的 socks v5 代理。

一切工作正常,但过了一段时间,我开始收到 yakuake 中的错误:

channel 57: open failed: connect failed: Connection refused
channel 12: open failed: connect failed: Connection refused
channel 13: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 13: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 10: open failed: connect failed: Connection refused
channel 6: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 9: open failed: connect failed: Connection refused
channel 22: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 9: open failed: connect failed: Connection refused
channel 15: open failed: connect failed: Connection refused
channel 16: open failed: connect failed: Connection refused
channel 9: open failed: connect failed: Connection refused
channel 29: open failed: connect failed: Connection refused
channel 16: open failed: connect failed: Connection refused

同时,我发现浏览器运行起来很慢。

然后我中断 yakuake 中的会话并开始新的会话,这在一段时间内有帮助,然后情况再次重复。

远程主机:

Ubuntu 14.04.3 LTS (GNU/Linux 2.6.32-042stab111.12 x86_64)

本地主机:

$ lsb_release -aNo LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty

有没有关于如何在不中断会话的情况下解决这个问题的帮助?我宁愿设置更大的超时时间(如果可能的话)而不是接收这些错误。

答案1

我无法说出您的具体错误,但您看到这些错误的原因是因为您的浏览器正在尝试建立 SSH 服务器不允许的连接。我使用的 SOCKS5 代理抛出大量错误,因为我的 /etc/hosts 文件中有 13,000 多个条目将广告服务器解析为 0.0.0.0,并且每次尝试加载广告时都会抛出错误,因为 0.0.0.0 拒绝连接。实际上,我发现这非常令人满意。

答案2

这对我来说适用于 google-chrome 上的 socks/socks5:

ssh -D 8080 -C -N [email protected]
google-chrome --proxy-server="socks://localhost:8080"
google-chrome --proxy-server="socks5://localhost:8080"

相关内容