RTerm Port Forward — what it is, who it’s for, how to use it
Port forward is the SSH tunnel feature in RTerm (Android SSH terminal). Your phone opens a small door on 127.0.0.1. Traffic that goes through that door is sent encrypted inside SSH and exits as if it started on your server.
Same idea as on a laptop:
- Local ≈
ssh -L … - SOCKS ≈
ssh -D …
In the app: open a session → ▶ menu → Port forwards. Rules use the current session’s login (host, user, key). Saved forward specs store no passwords. Listeners bind on the phone only (127.0.0.1), not the whole Wi‑Fi. Forwards stop when the last SSH session ends.
💡 If you only use RTerm for a shell (tmux, htop, vim), you can ignore this feature. When you need a private dashboard or DB that only listens on the server, this is the tool.
Who is it for?
| Person | Useful? |
|---|---|
| Shell-only SSH (htop, git, editors) | Rarely |
| Dev / admin with dashboards or DBs on the server | Yes |
| Services bound only to server localhost (not public) | Yes |
| Want the phone browser to exit from the VPS | Yes (SOCKS) |
| Casual terminal use | Usually skip |
Why use it? (five reasons)
- Private services stay private — Grafana, Portainer, admin UIs, etc. can listen on
127.0.0.1only. The tunnel reaches them without opening extra ports on the public internet. - No full VPN for one job — For “open this one thing on my VPS,” SSH forward is enough.
- Databases and local APIs — Postgres / MySQL / Redis on the server’s localhost map to a phone-local port for a GUI app or test client.
- Internal network via the server — The server can reach
10.xor office hosts; the phone usually cannot. A local forward targets hosts as seen from the server. - SOCKS = full proxy — Browser (or any SOCKS-aware app) uses the VPS path for many sites, not just one port.
What RTerm supports
1) Local forward
Phone 127.0.0.1:PHONE_PORT → from the server’s view TARGET_HOST:TARGET_PORT
Example:
- Phone port:
8080 - Target host:
127.0.0.1(the server itself) - Target port:
3000
Then open on the phone: http://127.0.0.1:8080 → hits whatever is on the server’s port 3000.
2) SOCKS proxy
Phone 127.0.0.1:PHONE_PORT (e.g. 1080) becomes a SOCKS5 proxy. Point a browser or system proxy there; each request is made from the server.
How to use it
Local example — web app only on the server
On the server (example):
python3 -m http.server 3000 --bind 127.0.0.1
On the phone:
- Connect SSH in RTerm.
- ▶ → Port forwards.
- Mode: Local.
- Phone port:
8080. - Target:
127.0.0.1/3000. - Save & start (or Start on a saved rule).
- Phone browser:
http://127.0.0.1:8080.
Stop the forward from the same screen when finished.
SOCKS example — browse “as the VPS”
- ▶ → Port forwards → SOCKS.
- Phone port:
1080. - Start.
- Set proxy to SOCKS5
127.0.0.1:1080(browser or system, if supported). - Open sites; “what is my IP” should match the VPS.
- Turn the proxy off when done (or stop the forward).
Not every Android browser makes SOCKS easy — some need a proxy-capable browser or system setting.
Concrete use cases
| Goal | Mode | Typical setup |
|---|---|---|
| Grafana only on server localhost:3000 | Local | phone 3000 → server 127.0.0.1:3000 |
| Admin UI / n8n / Home Assistant on VPS localhost | Local | same pattern |
| Postgres on server, GUI on phone | Local | phone 5432 → 127.0.0.1:5432 |
Host only the server can see (10.0.0.5:80) |
Local | phone 8080 → 10.0.0.5:80 |
| Browse internal wiki / use VPS IP | SOCKS | SOCKS on 1080 |
| Avoid opening extra cloud firewall ports | Local/SOCKS | service stays on 127.0.0.1; only SSH public |
What it is not
- Not a full VPN (not every app is forced through the tunnel).
- Not file transfer — use Browse remote files for that.
- Not required for everyday shell + tmux.
- Not “publish my phone to the internet” — only phone → through SSH → server side.
Short summary
| Question | Answer |
|---|---|
| What? | Encrypted tunnel: phone local port → via SSH → something reachable from the server |
| Who? | Devs/admins reaching private or internal services from the phone |
| Why? | Access without exposing ports; no separate VPN for simple cases |
| How? | ▶ → Port forwards → Local or SOCKS → Start → use 127.0.0.1:port or a SOCKS proxy |
| For what? | Dashboards, DBs, internal hosts, browser-via-VPS |
Part of RTerm
RTerm is a lean, SSH-first Android terminal (Rust core + Jetpack Compose) with sticky modifiers, correct key combos, multi-session tabs, macros, remote file browser, and this port-forward UI. Port forward is an optional power tool — shell-first users can leave it alone; when you need a private service on the VPS from your phone, it’s ready under ▶ → Port forwards.