Sync Android Files to PC Using Rsync Over SSH (No Root)

12 min read Learn how to synchronize files from your Android device to a PC using rsync over SSH, all without rooting. Step‑by‑step guide with Termux, key setup, and troubleshooting. October 14, 2026 02:00 How to Sync Android Files to a PC with Rsync Over SSH (No Root)

Before you start

Make sure you have the following ready before diving in:

  • A stable Wi‑Fi network that both your Android device and PC are connected to.
  • Termux installed from F-Droid or the Play Store.
  • A PC (Linux, macOS, or Windows 10/11) with an SSH server running. On Windows you can enable the built‑in OpenSSH server via Settings > Apps > Optional Features.
  • Enough battery on your phone or keep it plugged in – the process can take a few minutes for the first sync.
  • Basic comfort with command‑line operations.

If you need to install the OpenSSH server on your PC, see the brief notes in the Setup SSH Server section.

Step‑by‑step setup

1. Install required packages in Termux

  1. Open Termux and update its package list:
    pkg update && pkg upgrade -y
  2. Install openssh (provides the ssh client) and rsync:
    pkg install openssh rsync -y
  3. Verify the installations:
    ssh -V
    rsync --version
    You should see version strings, confirming they are ready.

2. Prepare the SSH server on your PC

  1. Linux/macOS: Most distributions ship sshd already. Ensure it is running:
    sudo systemctl enable ssh
    sudo systemctl start ssh
  2. Windows 10/11: Open Settings > Apps > Optional Features, click Add a feature, select OpenSSH Server, and install. Then start the service from an elevated PowerShell:
    Start-Service sshd
    Set-Service -Name sshd -StartupType Automatic
  3. Make a note of the PC's local IP address (e.g., 192.168.1.42) – you’ll need it later. On most systems you can get it with ip addr (Linux/macOS) or ipconfig (Windows).

3. Generate an SSH key pair on Android

  1. In Termux, run:
    ssh-keygen -t ed25519 -C "android@$(hostname)"
    Press Enter to accept the default file (~/.ssh/id_ed25519) and optionally set a passphrase. A passphrase adds security but requires you to type it each time you sync.
  2. List the generated keys to confirm:
    ls -l ~/.ssh
  3. Display the public key (the content you will copy to the PC):
    cat ~/.ssh/id_ed25519.pub

4. Copy the public key to the PC

  1. On the PC, open a terminal (or PowerShell) and create the .ssh directory if it does not exist:
    mkdir -p ~/.ssh
  2. Append the Android public key to authorized_keys. The easiest way is to paste the key you displayed in Termux:
    echo "(paste the whole line from Termux here)" >> ~/.ssh/authorized_keys
  3. Set proper permissions (Linux/macOS):
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
    On Windows, the permissions are handled automatically, but ensure the file is not world‑writable.
  4. Test the password‑less login from Termux:
    ssh -i ~/.ssh/id_ed25519 your_user@192.168.1.42
    You should land in a shell on the PC without being prompted for a password. If you set a passphrase for the key, you’ll be asked for that instead.

5. Decide which folders to sync

Common choices are:

  • /sdcard/Download – your downloads folder.
  • /sdcard/Documents – documents you edit on the phone.
  • /sdcard/Pictures – photos you want to back up.

For this tutorial we’ll sync the Download folder to a android_sync directory on the PC.

6. Run the first rsync command

  1. Create the target directory on the PC (once):
    mkdir -p ~/android_sync
  2. From Termux, execute rsync:
    rsync -avz -e "ssh -i ~/.ssh/id_ed25519" /sdcard/Download/ your_user@192.168.1.42:~/android_sync/
    • -a = archive mode (preserves timestamps, permissions, etc.).
    • -v = verbose – you’ll see which files are transferred.
    • -z = compress data during transfer (useful on slower Wi‑Fi).
    • -e = specify the remote shell and the private key.
  3. Watch the output. After the command finishes you should see a list of files that were copied. On the PC, verify that ~/android_sync contains the same files as /sdcard/Download.

7. Automate regular syncing (optional)

If you want the sync to run automatically, you can use Termux’s crond service or the Termux:Widget shortcut.

  1. Install cronie (a lightweight cron implementation) in Termux:
    pkg install cronie
  2. Create a cron file. Open an editor (e.g., nano) and add a line that runs rsync every hour:
    nano ~/.termux/cronjobs
    0 * * * * rsync -avz -e "ssh -i ~/.ssh/id_ed25519" /sdcard/Download/ your_user@192.168.1.42:~/android_sync/
  3. Start the cron daemon:
    sv-enable crond
    sv up crond
    The daemon will now read the file and execute the job at the scheduled times.
  4. Alternatively, create a widget shortcut: In Termux, run termux-widget to generate a shortcut that runs the rsync command with a single tap.

Troubleshooting common issues

Connection refused or timed out

  • Confirm both devices are on the same subnet (e.g., 192.168.1.x).
  • Check that the SSH service is running on the PC (systemctl status ssh on Linux/macOS, Get-Service sshd on Windows).
  • Firewalls can block port 22. Temporarily disable the PC firewall or add an inbound rule for SSH.

Permission denied (publickey)

  • Make sure the public key on the PC exactly matches the private key you are using in Termux.
  • Verify file permissions on the PC: chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys.
  • If you set a passphrase for the key, you must either type it when prompted or use ssh-agent inside Termux to cache it.
    eval $(ssh-agent -s)
    ssh-add ~/.ssh/id_ed25519

Rsync reports “file not found”

  • Android’s internal storage path can differ on some OEM skins. Use termux-setup-storage first, then verify the exact path with ls /sdcard.
  • Trailing slashes matter. /sdcard/Download/ (with slash) copies the contents, while /sdcard/Download (without) copies the folder itself.

Unexpected large data usage

  • Rsync only transfers differences, but the first run copies everything. Subsequent runs are incremental.
  • If you notice full transfers each time, check that the timestamps on the Android side are changing (some file managers modify them). Use the --size-only flag to ignore timestamp differences:
    rsync -avz --size-only -e "ssh -i ~/.ssh/id_ed25519" ...

Safety notes

  • Never expose your PC’s SSH server to the public internet without additional hardening (firewall, key‑based auth only, non‑standard port).
  • If you share the Android device with others, keep the private key in ~/.ssh and set its permissions to 600 to prevent other apps from reading it.
  • Regularly back up the authorized_keys file on the PC in case you need to restore access.

With the steps above you now have a reliable, password‑less, and bandwidth‑efficient way to keep your Android files synchronized with your PC. Adjust the source and destination paths to fit your workflow, and enjoy the peace of mind that comes from having an up‑to‑date backup without ever rooting your device.

User Comments (0)

Add Comment
We'll never share your email with anyone else.