---
title: "Unison file sync between Linux and iPhone over SSH"
language: en
topics: ["Freedom", "SSH", "cloud", "data", "howto", "iPhone", "linux", "server", "tablet"]
full_article_url: https://willem.com/en/2020-09-16_syncing-files-seamlessly-between-smartphone-and-tablet/
---
# Unison file sync between Linux and iPhone over SSH

*One shared folder on my own NAS instead of a big cloud drive.*

> In 2020 I synced a shared Cloud folder through my NAS: Unison pushed files from my Debian tablet over SSH on a cron job, and on the iPhone the Secure ShellFish app exposed the same folder in the Files app.

Unison is in the Debian repository and synchronises using rsync over SSH/SFTP. My profile defines two root folders, runs in batch mode and decides automatically which files to keep; man unison lists all parameters. Authentication uses shared SSH client keys, so no passwords are needed.
A cron job runs the sync frequently, guarded by a PID file so a new run only starts when the previous one has finished.
Routing everything through a NAS in a data center means tablet and phone stay in sync even when one of them is on a cellular network. The shared Cloud folder works like a desktop folder that exists on every device.
