The note is generated by “chatGPT”.
当希望 A 服务器借用 B 服务器的代理网络(例如 Clash/Mihomo 的 7890 端口)时,可以使用 SSH 的端口转发(ssh -L)来实现。
最终效果是:
A 访问 127.0.0.1:本地端口 → 通过 SSH 转发到 B:7890 → B 的 Clash 提供代理功能
1️⃣ 前提条件
A 可以 SSH 登录 B
The note is generated by “DeepSeek”.
一、基础设置步骤
1. 生成 SSH 密钥对(客户端)
| |
2. 复制公钥到服务器
方法一:使用 ssh-copy-id(推荐)
The note is generated by ChatGPT.
Observation — Proxy set, but SSH still fails
Although you set http_proxy / https_proxy (or all_proxy), running:
| |
still times out or fails.
Root cause — SSH does NOT use the HTTP proxy (key point)
Terminal HTTP/SOCKS environment variables affect HTTP/HTTPS-aware programs (curl, wget, git clone https://…, etc.), but OpenSSH does not honor those variables. SSH opens a raw TCP connection and must be explicitly told to use a proxy — otherwise it tries a direct connection and gets blocked by the network/firewall.
The note is generated by 豆包.
一、配置目的
通过 SSH Key 实现与远程仓库(GitHub/GitLab/Gitee 等)的无密码安全连接,避免每次操作远程仓库时重复输入账号密码。
二、操作步骤
1. 检查本地是否已存在 SSH Key
首先确认本地是否已有生成好的 SSH Key,避免重复创建。