iOS sessions disconnecting
iOS suspends apps in the background to save battery. When ZestSSH moves to the background (you switch to another app, lock the screen, or the display turns off), iOS can suspend it within seconds, and its SSH connections close.
ZestSSH asks iOS for no extra background time for SSH. The only background mode it declares is background fetch, which is for short updates, not for keeping a connection open.
What happens when you come back
Section titled “What happens when you come back”With Auto reconnect on (the default), ZestSSH connects the dropped sessions again as soon as it is back in front. A notice at the top says “Connecting 2 sessions again…” (or “Connecting a session again…”), with Why?, which opens a short explanation, “iOS & SSH connections”.
With Auto reconnect off, the notice says how many sessions were disconnected while ZestSSH was in the background, and you connect them yourself.
A session connected again is a new shell on the server. Its Startup command runs again, so a tmux command there brings you back to where you were (below).
Mitigations
Section titled “Mitigations”1. Use tmux on the server (recommended)
Section titled “1. Use tmux on the server (recommended)”tmux keeps your session running on the server whatever happens to the connection.
Set the host’s Startup command (optional) to:
tmux new-session -A -s mainThen:
- When ZestSSH connects again after iOS closed the connection, you are back in your running session.
- Long commands (builds, downloads) go on on the server while your phone is locked.
See the tmux workflow guide.
2. Keep the screen awake
Section titled “2. Keep the screen awake”Keep screen awake (“Prevent screen dimming during sessions”) is on by default, in Settings > Terminal and SSH. While a session is open in front, the screen does not dim or lock, so iOS does not move ZestSSH to the background.
3. Keepalive
Section titled “3. Keepalive”A keepalive keeps a quiet connection from being dropped by routers and firewalls while ZestSSH is in front. It cannot stop iOS from suspending the app. Set it for every host in Settings > Terminal and SSH > Keepalive interval (the default is 30 seconds), or for one host in its editor.
4. Guided Access
Section titled “4. Guided Access”iOS Guided Access keeps the device in one app:
- Turn it on in iOS Settings > Accessibility > Guided Access.
- Open ZestSSH and triple-click the side button to start Guided Access.
- The device stays in ZestSSH until you end Guided Access.
Mosh is not available on iPhone and iPad. ZestSSH opens Mosh hosts on a computer only (Windows, macOS and Linux). See Mosh.
Best practice for iOS
Section titled “Best practice for iOS”- Run tmux on every server you connect to.
- Use
tmux new-session -A -s mainas the host’s startup command. - Leave Auto reconnect on.
- When you come back to ZestSSH, it connects again and tmux puts you back where you were.