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 🙂 

Annunci
Using Keepass synced between computers using OneDrive