Remote forwards
Remote forwarding opens a listening port on the SSH server that tunnels connections back to a port on your device (or on your device’s network). Traffic flows the opposite way from local forwarding: from the server side, through the SSH tunnel, to your side.
Remote forwarding is free on every plan.
Equivalent SSH command: ssh -R [remote_address:]remote_port:local_host:local_port user@server
When you actually want this
Section titled “When you actually want this”Remote forwarding is uncommon. Most people never need it. It solves one kind of problem: something on the server side needs to reach something on your side.
- Showing a local dev server to a colleague. You develop a web app on your laptop. A teammate with SSH access to a shared server needs to see it. A remote forward makes the server’s port 9000 lead back to your laptop’s port 3000.
- Webhook testing. A program on the server sends HTTP callbacks to a service running on your machine.
- Debugging. A process on the server connects to a debugger or logging agent running on your device.
- A local database for a server-side script. A migration tool on the server reads from a database on your laptop through the server’s port 3306.
If you are trying to reach something on the server from your device, you want Local forwarding instead.
Server configuration: GatewayPorts
Section titled “Server configuration: GatewayPorts”By default, most SSH servers open remote forwarded ports on 127.0.0.1 on the server, so only programs on the server itself can connect. If other machines on the server’s network must reach the forwarded port, the server administrator edits /etc/ssh/sshd_config:
GatewayPorts yesOr, for more control:
GatewayPorts clientspecifiedWith clientspecified, the client chooses the address the server listens on (for example 0.0.0.0 for every interface). In ZestSSH that is the Destination host on a phone, or the host under Destination in a computer’s Advanced mode (see below). After changing the config, restart the SSH daemon (for example sudo systemctl restart sshd).
Without GatewayPorts, the remote forward is private to the server. That is the safest default, and it is enough when only programs on the server need the tunnel.
How the fields map for a remote forward
Section titled “How the fields map for a remote forward”ZestSSH uses the same fields for every type, and for a remote forward they mean this:
| Field (phone) | Field (computer, Advanced) | For a remote forward it is |
|---|---|---|
| Destination port | Destination port | The port opened on the server. |
| Destination host | Destination host | The address the server listens on. localhost (the default) means only the server itself; 0.0.0.0 needs GatewayPorts clientspecified. |
| Source port | Source port | The port on your device that the server’s connections are handed to. |
| Bind address | Source host | The address on your side that ZestSSH connects to for each of those connections. 127.0.0.1 means your own device; another address on your network works too. |
In other words: Source is always your side, Destination is always the server’s side. A remote forward is shown as server address:server port → your address:your port.
Configuring in ZestSSH
Section titled “Configuring in ZestSSH”On a computer
Section titled “On a computer”-
In the side rail, under Manage, click Port forwarding, then New rule.
-
In Simple mode, under What do you want to do?, pick Share a service from this device.
-
Set Name and the Server, then:
- Port here: the port of the service on this device.
- Port on server: the port to open on the server.
Simple mode hands connections to
localhoston this device. The tunnel picture says what will happen, for example “While it runs, anything on shared.example.com that opens localhost:9000 reaches port 3000 on this device.” For other addresses, use Advanced with Type Remote (-R). -
Optional: Let other machines reach it asks the server to listen on every address it has, so machines that reach the server can use the port, “if its SSH server allows it (GatewayPorts)”. ZestSSH asks you first in Let other devices reach this forward?.
-
Click Save, then Start, or Save and start.
On a phone or tablet
Section titled “On a phone or tablet”- Connect to your server and tap the Port forward button (two arrows) in the session toolbar.
- Tap Add.
- Select Remote.
- Fill in the fields:
- Nickname (optional): something descriptive, like “Dev server for Sam”.
- Source port: the port of the service on your device.
- Destination host: leave
localhostunless the server should listen on another address. - Destination port: the port to open on the server.
- Bind address: leave
127.0.0.1for a service on your own device.
- Tap Add, then start the forward with the play button.
Example: sharing a local web app
Section titled “Example: sharing a local web app”You run a dev server on your laptop at localhost:3000. Your colleague Priya can SSH into shared.example.com, and you want her to see your app at http://localhost:9000 on that server.
On a phone:
Type: RemoteSource port: 3000Destination host: localhostDestination port: 9000Bind address: 127.0.0.1On a computer, Simple mode: Port here 3000, Port on server 9000.
Priya opens http://localhost:9000 on the shared server (or forwards that port to her own machine). The request travels through your SSH tunnel to your laptop’s port 3000.
Example: webhook testing
Section titled “Example: webhook testing”A CI pipeline on the server sends a POST to http://localhost:8888/webhook when a build completes. You want it to reach a handler on your laptop at port 8888.
Type: RemoteSource port: 8888Destination host: localhostDestination port: 8888The pipeline hits localhost:8888 on the server, the request tunnels through SSH to your laptop, and your handler gets it.
Security considerations
Section titled “Security considerations”- A remote forward opens a way from the server to your side. Only forward to services you mean to expose.
- Listening on
localhoston the server keeps the port to programs running on the server. This is the safest option. - If
GatewayPortsallows it and the server listens on0.0.0.0, anyone who can reach the server can connect through the tunnel to your device. - Remote forwards close when the SSH session ends. Nothing stays open after you disconnect.
- A remote forward does not turn your device into an SSH server. It exposes one port on your side to one server you are already connected to, through that outgoing connection, and only while the session is open. ZestSSH has no SSH server mode on any platform (see Local shell for the Android specifics).
Troubleshooting
Section titled “Troubleshooting”The forward does not start: the server refused to open the port, often because something on the server already listens on that Destination port (the server port), or the server does not allow remote forwarding for your account. On a computer the notice says “The host refused to forward this port.”; on a phone’s session screen the message names the forward and gives the same reason. Pick another server port, or ask the administrator.
Connections through the server port fail: check that the service on your side is running and listening on the Source port, at the Bind address. When it does not answer, ZestSSH says “This device could not connect to (address:port), where the forward hands its connections on.” in the notification bell, and the program on the server side is cut off cleanly. Also check that you picked Remote and not Local.
Other machines cannot connect to the server port: the server’s GatewayPorts is likely no (the default). Ask the administrator to change it, or have the other program connect to the server’s localhost instead.
Related
Section titled “Related”- Port forwarding overview: the three types compared.
- Local forwards: the far more common direction.
- SOCKS5 proxy: route traffic instead of a single port.