SSH
, Common
Syntax
ssh -R [bind_address:]remote_port:target_host:target_port [user@]ssh_server
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-R |
ssh -R 8080:localhost:3000 user@host |
Common | |
-N |
command | ssh -NR 8080:localhost:3000 user@host |
Common |
-f |
ssh -fNR 8080:localhost:3000 user@host |
Common | |
GatewayPorts |
, localhost | GatewayPorts yes # sshd_config |
Advanced |
bind_address |
ssh -R 0.0.0.0:8080:localhost:3000 user@host |
Advanced |
Examples
Web
ssh -NR 8080:localhost:3000 user@public-server
public-server:8080 3000
ssh -NR 9000:localhost:5173 user@shared-server
shared-server:9000 Vite
ssh -fNR 5005:localhost:5005 user@test-server
GatewayPorts
# /etc/ssh/sshd_config : # GatewayPorts yes ssh -NR 0.0.0.0:80:localhost:3000 user@server
127.0.0.1, GatewayPorts IP
Common Errors
Warning: remote port forwarding failed for listen port(<1024 root), sudo
localhost, sshd_config GatewayPorts yes sshd
Tips
- : -R :, """"
- GatewayPorts yes
- ngrok/frp and more SSH