ZSFrp 文档
隧道管理

SSH

通过 TCP 映射 SSH(默认 22),从外网 ssh user@节点 -p 远程端口 登录内网主机。

通过 TCP 映射 SSH(默认 22),从外网 ssh user@节点 -p 远程端口 登录内网主机。

推荐配置

项目值
协议TCP
本地地址127.0.0.1:22(改端口则填实际值)
远程端口随机或高位端口

📷 图片占位 /images/docs/tunnel-management/ssh-create.png
建议内容:SSH 场景创建界面。

连接流程

1. 确认 sshd

# Linux
sudo systemctl status ssh
sudo ss -tlnp | grep :22

2. 创建并启动

创建隧道 → 启动 frpc

3. 外网连接

ssh 你的用户名@节点域名 -p 远程端口

📷 图片占位 /images/docs/tunnel-management/ssh-terminal.png
建议内容:终端 SSH 登录成功。

密钥登录(强烈推荐)

ssh-keygen -t ed25519 -C "your@email"
ssh-copy-id -p 22 user@127.0.0.1

/etc/ssh/sshd_config:

PasswordAuthentication no
PubkeyAuthentication yes

修改前 确保密钥可登录,否则锁死自己。

Windows / WSL

环境说明
WSL2在 WSL 内跑 frpc 并映射 WSL 的 sshd,或端口转发到 Windows
OpenSSH Server可选功能安装后默认 22 端口,用法同 Linux

与 Proxy Protocol

SSH 不需要 Proxy Protocol,保持关闭。见 Proxy Protocol。

常见问题

问题处理
Connection refusedsshd 未启动或端口错
Permission denied用户/密钥错误
隧道离线离线排障

安全

  • 禁用 root 密码登录(如适用)
  • 可配合 fail2ban
  • 不用时停止隧道

相关文档

On this page