Using Keepass synced between computers using OneDrive

If you, like me, cannot live without Keepass, well, you maybe need a sync mechanism to always have updated password db over two or more computers.

Since I was not able to find a plug-in to make this sync automatic (I refer to a few years ago, actually I don’t know if there is something new that I could use), I settled the tool to use “triggers” (that is a feature available to execute actions) to implement this sync mechanism.

The sequence of action that I created was:

  • Keepass use a local password db
  • when Keepass opens the local db, first of all sync it with a cloud-based password db copy (in this example I use OneDrive, but you can use Dropbox, Sugarsync, Google Drive, or your favorite cloud space)
  • when Keepass save the local db, it sync again with the could-based copy

To implement this sequence I used Keepass triggers, as I said before.

All steps to reproduce it are explained in the next lines. I would like to share for whom it may be useful.

Files involved are:

  • local_file.kdbx: file to sync on local machine (e.g. C:\CRYPT\MyKeePassFile.kdbx)
  • sync_file.kdbx: file located in a share folder or cloud drive, in a synced local folder on the machine (e.g. C:\User\<username>\OneDrive\MyKeePassFile.kdbx)

Go to Tools > Triggers

  • Enable trigger system => <checked>
  • Add (trigger)
    • Properties
      • Name => “trig-first-open-sync”
      • Enabled => <checked>
      • Initially on => <checked>
      • Turn off after executing action (run once) => <checked>
    • Events
      • Add
        • Event => Opened database file
        • File/URL – Comparison => Equals
        • File/URL – Filter => <local_file.kdbx>
    • Conditions
      • Add
        • Not => <not checked>
        • Condition => File exists
        • File => <sync_file.kdbx>
    • Actions
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-saved-file-sync”
        • New state => Off
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-first-open-sync”
        • New state => Off
      • Add
        • Action => Synchronize active database with a file/URL
        • File/URL => <sync_file.kdbx>
        • IO Connection – User Name => <blank> or username when required
        • IO Connection – Password => <blank> or password when required
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-first-open-sync”
        • New state => On
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-saved-file-sync”
        • New state => On
  • Add (trigger)
    • Properties
      • Name => “trig-saved-file-sync”
      • Enabled => <checked>
      • Initially on => <checked>
      • Turn off after executing action (run once) => <not checked>
    • Events
      • Add
        • Event => Saved database file
        • File/URL – Comparison => Equals
        • File/URL – Filter => <local_file.kdbx>
    • Conditions
      • Add
        • Not => <not checked>
        • Condition => File exists
        • File => <sync_file.kdbx>
    • Actions
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-saved-file-sync”
        • New state => Off
      • Add
        • Action => Synchronize active database with a file/URL
        • File/URL => <sync_file.kdbx>
        • IO Connection – User Name => <blank> or username when required
        • IO Connection – Password => <blank> or password when required
      • Add
        • Action => Change trigger on/off state
        • Trigger name => “trig-saved-file-sync”
        • New state => On

That’s it. Have fun with Keepass :-) 

Using Keepass synced between computers using OneDrive

6 pensieri su “Using Keepass synced between computers using OneDrive

  1. Hi, I’ve simply saved the file directly on my OneDrive, and I open from there. I let OneDrive sync the online file with the local one, so its happen transparently to Keepass, and I can sync also with other KeePass clients (WinRT).
    No need to set all this stuff.
    Do I miss something?

    1. Holger ha detto:

      Hi Nicolò, this will lead to dataloss if you have changes on multiple Clients, as OneDrive only detects that something has changed and not what was changed. with a sync by onedrive only the changes by one Client will be kept all other changes will be lost. A Sync through KeePass will keep all changes including multiple changes on the same entry, as they will be logged in the entries history.

  2. Hi Nick, I use Keepass from a lot of years, and in the past I had problems using directly a file from a cloud-synced folder, because sometimes I had a multiple copy of my db file into the folder, created by the sync mechanism (at that time I was using another cloud-space provider, as I switched to sync Keepass through OneDrive just a couple of months ago).
    For this reason I opted to have a double copy on the same disk, one currently using and another just for sync.

    Maybe with OneDrive I will never get multiple copy of my file during the sync operation, anyway the procedure I explained is just an option, that is working very fine for me from a few years, so I will use it again.🙂

  3. Ok, now I remember the killer motivation to use this approach: concurrency between more than one place. In that case, OneDrive use the last version of the file, instead of “merge” file contents😉
    In fact, now I am using a Keepass file between different people, and this is a mortal limit!

  4. Cubed ha detto:

    Thank you so much for the easy-to-follow instructions, and for making it so convenient to have up-to-date kdbx file across my desktop and laptop!

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...