Skip to content

iOS Backgrounding

This is the most important platform-specific page for iOS users. iOS suspends apps after approximately 30 seconds in the background, disconnecting all SSH sessions. This is not a ZestSSH bug — it is a platform restriction that affects every SSH client on iOS.

When you switch to another app or lock your screen on iOS:

  1. iOS suspends ZestSSH after approximately 30 seconds.
  2. All active SSH connections are disconnected by the operating system.
  3. All port forwards and SFTP transfers in progress are terminated.
  4. Any unsaved work in remote editors (vim, nano, emacs) may be lost if the session is not recovered by the server.

iOS enforces strict background execution limits to preserve battery life and system resources.

Unlike Android, iOS does not allow apps to maintain persistent network connections in the background without using specific entitlements. The available background modes (audio, location, VoIP, Bluetooth) do not apply to SSH connections.

This is not a ZestSSH limitation. Every SSH client on iOS has this same constraint, including Termius, Prompt, and Blink Shell.

ZestSSH implements several mitigations to minimize the impact:

When you return to the app, ZestSSH automatically detects disconnected sessions and reconnects them with exponential backoff. You do not need to manually reconnect — the app handles it transparently.

Your terminal scrollback and local session history are preserved even after a disconnect. When you return, you can see everything that was on screen before the disconnection.

Port forward rules are saved persistently and can be configured to auto-activate on reconnect. When a session reconnects, your port forwards resume automatically.

When a session disconnects due to backgrounding, a snackbar notification appears to inform you of the disconnection and the automatic reconnect attempt.

A terminal multiplexer running on the server keeps your session alive regardless of what happens to the SSH connection:

$ tmux new -s work

Your session persists on the server even when iOS kills the SSH connection. When ZestSSH reconnects, reattach to your session:

$ tmux attach -t work

GNU screen works the same way:

$ screen -S work
$ screen -r work # reattach after reconnect

Mosh is specifically designed for mobile and intermittent connections:

$ mosh user@server

Mosh handles roaming, intermittent connectivity, and high latency gracefully. It uses UDP instead of TCP, so it can resume instantly after a network change without establishing a new connection. ZestSSH supports Mosh connections natively.

For the most resilient setup, use Mosh as the transport layer and tmux on the server:

  1. Connect via Mosh for resilient transport.
  2. Run tmux on the server for persistent sessions.
  3. Even if Mosh’s UDP state expires, tmux keeps your session alive for reattachment.

Why ZestSSH Doesn’t Use Background Workarounds

Section titled “Why ZestSSH Doesn’t Use Background Workarounds”

Some apps abuse UIBackgroundModes (such as playing silent audio or using location updates) to keep connections alive in the background. ZestSSH does not do this because:

  1. Apple actively rejects apps that misuse these entitlements. Apps caught playing silent audio to maintain connections are removed from the App Store or required to remove the workaround.

  2. Battery drain. Background audio or location hacks keep the CPU and radio active, significantly draining battery life — exactly the problem Apple’s background restrictions are designed to prevent.

  3. Unreliable. Even these workarounds can fail: iOS may still terminate the app during memory pressure, after an iOS update, or when the system decides the background activity is not legitimate.

  4. App Store compliance. ZestSSH prioritizes a reliable, App Store-compliant experience over workarounds that could stop working with any iOS update and risk the app’s listing.

Q: Can ZestSSH keep connections alive in the background on iOS? A: No. iOS does not provide a legitimate background mode for SSH connections. No SSH app on iOS can reliably maintain connections in the background.

Q: Why does Android allow background connections but iOS doesn’t? A: Android’s foreground service API allows apps to run persistent tasks with a visible notification. iOS has no equivalent mechanism for arbitrary network connections.

Q: Will this ever be fixed? A: This depends on Apple adding a background networking entitlement for SSH-type connections. As of iOS 18, no such entitlement exists. The tmux/Mosh approach is the reliable, permanent solution.

Q: My session disconnected and I lost unsaved work. What can I do? A: Use tmux or screen on the server going forward. These tools keep your editor session alive on the server even when the SSH transport drops. Some editors (vim) also maintain swap files that allow recovery.