Make sure you have the following ready before diving in:
Settings > Apps > Optional Features.If you need to install the OpenSSH server on your PC, see the brief notes in the Setup SSH Server section.
pkg update && pkg upgrade -y
openssh (provides the ssh client) and rsync:
pkg install openssh rsync -y
ssh -V
rsync --version
You should see version strings, confirming they are ready.
sshd already. Ensure it is running:
sudo systemctl enable ssh
sudo systemctl start ssh
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic
192.168.1.42) – you’ll need it later. On most systems you can get it with ip addr (Linux/macOS) or ipconfig (Windows).
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.
ls -l ~/.ssh
cat ~/.ssh/id_ed25519.pub
.ssh directory if it does not exist:
mkdir -p ~/.ssh
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
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
On Windows, the permissions are handled automatically, but ensure the file is not world‑writable.
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.
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.
mkdir -p ~/android_sync
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.~/android_sync contains the same files as /sdcard/Download.
If you want the sync to run automatically, you can use Termux’s crond service or the Termux:Widget shortcut.
cronie (a lightweight cron implementation) in Termux:
pkg install cronie
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/
sv-enable crond
sv up crond
The daemon will now read the file and execute the job at the scheduled times.
termux-widget to generate a shortcut that runs the rsync command with a single tap.
192.168.1.x).systemctl status ssh on Linux/macOS, Get-Service sshd on Windows).chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys.ssh-agent inside Termux to cache it.
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
termux-setup-storage first, then verify the exact path with ls /sdcard./sdcard/Download/ (with slash) copies the contents, while /sdcard/Download (without) copies the folder itself.--size-only flag to ignore timestamp differences:
rsync -avz --size-only -e "ssh -i ~/.ssh/id_ed25519" ...
~/.ssh and set its permissions to 600 to prevent other apps from reading it.
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.









