Picture of Patrick, owner of this site

Welcome to panisch.com

Sharing some thoughts

Synchronize KeePass without conflicts

Synchronize a KeePass database across all your devices with Syncthing instead of Dropbox.

Patrick

Picture of a sunset in Africa.

Introduction

KeePass is an open source tool to store all your passwords. You only need to remember your master password for KeePass and store trillions of individual passwords for each of your accounts. To have all your passwords at hand, you probably want the KeePass database (where all your passwords are stored) on all your devices (phones, laptops, PCs, tablets, etc.). To do so, you can synchronize them. Here is how you can do it, but be aware of the limitations below.

Simple sync (with Dropbox, etc.):

  1. Store KeePass database file (.kdbx) in your Dropbox share folder, e.g. /Dropbox/keepass.kdbx
  2. The KeePass file now gets synchronized via Dropbox so that you are able to read/write to that file from your PC, laptop and phone
  3. But a conflict may occur when you edit the file on your PC and shortly after also on your phone before Dropbox could sync the PC-changes first. As Dropbox can’t merge both changes (KeePass files are encrypted), it will keep both versions of the file. Dropbox tells you about the conflict via the filename. If that happens to you, you now need to merge these files manually: Open both files and copy the changes from the conflict-version to the actual no-conflict-version.

Advanced sync (with Syncthing or Dropbox or …):

The following instruction ensures, that you are always saving the KeePass database to a local file on your PC, which cannot be changed by Android except through the KeePass sync process; you always have a backup in case something goes wrong.

  1. Work on a local KeePass file on your device (e.g. “D:\MyData\ActiveKeepass.kdbx”)
  2. Create a copy in your shared folder (e.g. “D:\Dropbox\Shared.kbdx”)
  3. Create a KeePass Trigger like this:
  • In KeePass: Tools > Triggers. Ensure that “Enable trigger system” is checked.
  • Add a trigger: “AutomaticSync”. When editing it, check “Enabled” and “Initially on” to ensure that it always runs.
  • Under the Events tab, add the following Events, in order, which define the local database:
    • Opened database file : Equals, D:\MyData\ActiveKeepass.kdbx
    • Application started and ready
    • Saved database file : Equals, D:\MyData\ActiveKeepass.kdbx
    • Time - Periodic : 3600, No
  • Under the Actions tab, add the following Actions, in order, which define the sync path:
    • Change trigger on/off state : Off
    • Synchronize active database with a file/URL: D:\Dropbox\Shared.kbdx
    • Change trigger on/off state : On
  • Source: https://github.com/PhilippC/keepass2android/issues/617

Limitations

  • Only KeePass allows triggers (not KeePassXC yet)
  • KeePass (without “XC” only runs on Windows natively)
  • Syncthing doesn’t work on Apples iOS (Dropbox still runs though)

Recent Posts

About

Hey there! My name is Patrick and I live and work in Stuttgart, Germany. I write about IT and technology, climate and life, travel stories and I might show you a nice photograph here and there. Enjoy the blog! PS: Ändere die Sprache auf Deutsch, wenn du magst, in der oberen rechten Ecke.