This commit is contained in:
colben
2024-07-02 21:08:41 +08:00
parent abe83ec6bb
commit a6bccc5347
2 changed files with 168 additions and 12 deletions

View File

@@ -7,17 +7,8 @@ tags: ["ssh", "隧道", "转发"]
categories: ["shell"]
---
## sshd 常规设
- 禁用 root 远程登陆
```
PermitRootLogin no
```
- 只允许私钥登陆
```
PubkeyAuthentication yes
PasswordAuthentication no
```
- 开启端口转发功能
## 开启端口转发配
- 修改 sshd 配置
```
AllowTcpForwarding yes
GatewayPorts yes
@@ -27,7 +18,7 @@ categories: ["shell"]
ClientAliveCountMax 3
```
## ssh 参数
## ssh 转发用到的参数
- -f 后台运行
- -N 仅作端口转发,不执行任何命令
- -g 绑定端口到全部网卡