Running the Server¶
Once the server has joined a relay, a single command brings everything up.
Start¶
This runs in the foreground (Ctrl-C stops it) and starts, in one process:
- Embedded SSH server on
:2222— the tunnel endpoint clients land on. It enforces per-userpermitopenrestrictions fromauthorized_keys, which it re-reads on every auth attempt. - Xray client tunnel to the relay — VLESS + XHTTP over TLS on port 443, presenting the server's client certificate to the relay's mutual-TLS gate.
- SSH reverse tunnel through Xray — publishes the server's SSH endpoint on the relay's
127.0.0.1:<remote_port>(the port assigned at enrollment), so clients can reach it. End-to-end SSH encryption means the relay never sees plaintext. - gRPC API on
:50051— the local management API. Othertwcommands (status,user list, ...) talk to the running daemon through it, and fall back to operating on local files when it's not running. - Web dashboard on
http://localhost:8080— live status, user management, logs. Started whenserver.dashboard_portis set (it is by default); set it to0to disable.
All ports are configurable in config.yaml under the server section (ssh_port, api_port, dashboard_port).
Test¶
Verifies the whole path to the relay — DNS, HTTPS/mTLS admission, and SSH over the tunnel. Expect "tunnel and shell working". Runs via the daemon when the server is up, or standalone when it isn't.
Status¶
Prints the unified status view: the active context (name, mode, relay, config path), user counts (total and currently connected), the relay block (provisioned, IP, provider), and the health of each server component (SSH, Xray, tunnel) with any tunnel error.
If the daemon isn't running, status falls back to local state and says so. If a running service was started under a different context than the currently active one (after a tw config use-context switch), status prints an explicit mismatch warning — restart the service to apply the switch.
Top-level tw status
Plain tw status works in any mode (or none) and shows the same view — it's the "what is going on here?" entry point.
Run as a Service¶
To keep the server running in the background and start it on boot:
tw service stop and tw service uninstall undo these. While the service is running, the regular CLI commands transparently talk to it over the gRPC API.
What's Next¶
- Create users for your clients
- Configure a proxy if the server sits behind a corporate proxy
- Troubleshooting if the tunnel won't come up