iOS Session Management
iOS imposes restrictions on background execution that can cause SSH sessions to disconnect when ZestSSH is not in the foreground. This page explains the limitations and best practices.
The Problem
Section titled “The Problem”iOS aggressively suspends background apps to conserve battery and memory. When ZestSSH goes to the background (e.g., you switch to another app), iOS may suspend the app after a short period, causing the SSH connection to drop.
This is an iOS platform limitation, not a ZestSSH bug. All SSH clients on iOS face this challenge.
How ZestSSH Handles It
Section titled “How ZestSSH Handles It”ZestSSH uses available iOS background execution APIs to keep sessions alive as long as possible. However, iOS does not guarantee unlimited background time for third-party apps.
Tips for Maintaining Sessions
Section titled “Tips for Maintaining Sessions”Keep ZestSSH in the Foreground
Section titled “Keep ZestSSH in the Foreground”- Use Split View or Slide Over on iPad to keep ZestSSH visible while using another app.
- On iPhone, minimize the time spent in other apps if you need to keep a session active.
Use Keep-Alive Packets
Section titled “Use Keep-Alive Packets”Enable keep-alive in your connection settings. While this does not prevent iOS from suspending the app, it helps quickly detect and re-establish connections after the app returns to the foreground.
Reconnect Quickly
Section titled “Reconnect Quickly”ZestSSH saves your session state. When you return to the app after suspension:
- The app detects the connection was dropped.
- You can quickly reconnect by tapping the connection.
Use Screen Lock Instead of App Switching
Section titled “Use Screen Lock Instead of App Switching”If you need to step away briefly, locking the screen (rather than switching to another app) may give you slightly more background time in some iOS versions.
Server-Side Solutions
Section titled “Server-Side Solutions”Consider running persistent terminal sessions on the server that survive client disconnections:
- tmux: Run
tmuxafter connecting, and usetmux attachto reattach after reconnection. - screen: Run
screenand usescreen -rto reattach.
This way, even if the iOS connection drops, your work on the server is preserved.
Use Automation for Quick Commands
Section titled “Use Automation for Quick Commands”For commands that do not require an interactive session, use iOS Shortcuts to run commands quickly without needing to keep a long-lived session open.