Why Your SSH Session Drops on iPhone and How ServerPanel Reconnects Automatically
Keep-alive pings every 30 seconds by default, and automatic reconnect retries with a backoff when the network changes or the app returns from the background, replaying what you typed during the gap. It is not Mosh: the server-side process still needs tmux to survive.
The problem
You start something on a server, put the phone in your pocket and walk out of Wi-Fi range. Or you lock the screen for a minute, or you’re on a train. When you come back the terminal says the connection is closed. The command you were running might be gone, you have to reconnect by hand and you’ve lost your place. SSH was designed for stable desktop connections, not for phones that change network several times an hour.
What ServerPanel does about it
Two settings, in Settings → Connection:
- Keep-alive sends a small signal at an interval (30 seconds by default) so idle sessions aren’t dropped by timeouts on the server or in between.
- Auto-reconnect (on by default) re-establishes a dropped shell across network changes and app backgrounding. It retries with a short, growing delay (starting under a second, up to about 6 seconds, for several attempts). After that it waits for a nudge: a network change, coming back to the foreground or a manual tap. Anything you typed during the gap is replayed once reconnected.
What it does not do
This is a reconnect, not Mosh. Mosh uses its own protocol so the session itself roams seamlessly. ServerPanel makes a new SSH connection, so the shell on the server is new unless you use something that persists.
That means:
- A foreground command can be killed when the connection drops.
- Use tmux (or screen) for anything that must survive. Reattach and everything is exactly where you left it.
A reliable setup
- On the server, run long jobs inside
tmux. - Leave keep-alive on (30 seconds is fine).
- Leave auto-reconnect on.
- After a drop, reconnect and use the tmux switcher to jump back to your session.
Tuning
- Keep-alive too aggressive on a very battery-sensitive day? Increase the interval.
- Corporate or cheap hosts that drop idle connections quickly? Shorten it.
- Both apply to new sessions, so reconnect to see the change.
FAQ
Is this Mosh? No. It reconnects the SSH session after a drop. It does not use the Mosh protocol, which would need mosh-server on the server.
Will a running command survive? Not by itself. When SSH drops, the shell on the server may end. Run long jobs inside tmux or screen.
Can I turn it off? Yes. Keep-alive interval and automatic reconnect are in Settings → Connection. They apply to new sessions.
What happens to text I type while offline? It is held and replayed after the connection is back.