Syncing keepass database between android and desktop with rsync
By Krolyxon • 2 minutes read •
This post has been archived on 2025-06-22.
Introduction to keepass
Everyone should use password managers, because remembering unique passwords is difficult. There are many great FOSS password managers such as Bitwarden, Keepass, KeepassXC etc. I wouldn’t recommend using Bitwarden because its cloud based, Your password database is being stored in cloud, and it makes me really paranoid, since there are thousands of users using it, lots of hackers are always trying to break into Bitwarden’s server and potentially leak the passwords.. Even though Bitwarden allows you to self-host your own vault, i still feel paranoid about having my password database have anything to do with the internet. So instead, i go with KeepassXC because it is completely localized and offline. You can read the installation instructions and read more about it on keepassxc.org However, we are going focus more on how to sync the password database created from Keepassxc on your desktop and cellphone(android).
After you are done installing Keepassxc on your desktop, install keepassdx on your cellphone, To access your encrypted password database from your cellphone.
Sync the database between both devices.
- Install rsync and ssh(obviously…) on your desktop.
- Install termux on your cellphone.
- install
rsync
&openssh
on termux by runningpkg install openssh rsync
- start ssh server on termux by running
sshd
- get your local ip adress of your cellphone by running
ifconfig
Once you are done with that, go to the terminal on your desktop and run this command:
here i specify the port with --rsh='ssh -p 8022'
because specifying it with --port
flag didng work for me. repace your username with your username and local ip adress of termux in username@ip
. and repace the paths in the commands to where your password database is stored in your desktop and cellphone. and here we go, it will sync the database.
However, i wanted to go further and make it a bit automaticish, so i ended up with this script.
#!/bin/sh
# paths of database file locations in android and desktop
anpath="storage/shared/path/to/pass-database.kdbx"
deskpath="path/to/pass-database.kdbx"
# getting last modified date
desktop=
android=
# syncing the database between both devices by calculating
# in which device the password database was last modified.
# not syncing anything if there was no change.
if [; then
elif [; then
elif [; then
fi
When i run this script, it will check in which device i had the password database last modified, and sync the password database from desktop to cellphone if it was last modified on my desktop computer and vice versa.