Backup KeePass2 database on Linux

There are several instructions on how to use the KeePass2 trigger mechanism to create a backup of your password database when saving the database.  However, all of the instructions I found were for Windows.  It took a bit of figuring out what is the proper configuration on Linux, so here are the necessary steps:

  1. Select ToolsTriggers…
  2. Click Add…
  3. Type the name Backup database on save and make sure Enabled and Initially on are checked
  4. Under the Events tab click Add…, select Saving database file and click OK (ignore the conditions)
  5. Under the Actions tab click Add…, select Execure command line / URL and type in the following:
    Arguments"{DB_PATH}" "{DB_PATH}.{DT_SIMPLE}"
    Wait for exit:  checked
  6. Click OK a few times

This will create a backup of the database file every time you save it (before the save).  The backup will be in the same directory as the original, with the current timestamp appended to the name.  If you prefer to backup to a different directory, use "/path/to/backups/{DB_BASENAME}.{DT_SIMPLE}" as the second argument instead.

This entry was posted in KeePass, Security and tagged . Bookmark the permalink.

3 Responses to Backup KeePass2 database on Linux

  1. klemen says:

    Since this is not working (for me), do you happen to know, how to debug, why this isnt working?

  2. Autiwa says:

    Interesting post. However, how can we make a line that works both for linux and windows? Right now I followed a tutorial for windows and assumed it would work on linux by using the “{END_DIRSEP}”, to no avail. I’m surprised because the tutorial I followed use the command “mkdir” that exist on linux, but the folder is never created.

    How can we debug triggers? I know it is launched (by adding a message box), but that’s it.

  3. Count Zero says:

    Thanks for your post, worked for me

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s