Save data after adding new entry

21

4

Is it possible (by option or trigger) to save the Keepass database automatically after I added a new entry?

I often forget to save it and then lose the new data when shutting down windows.

Alternatively: Is it possible to save the data when KeePass is forced to close when Windows exits?

magnattic

Posted 2012-01-23T19:22:35.380

Reputation: 1 176

Answers

9

There's an auto-save option in Tools -> Options... -> Advanced. If this sometimes fails to work, it may be a bug. A way to mitigate this is to use a shorter auto-lock period so the database will be saved more frequently.

Also, KeeFox does auto-save when you save a new password from the browser. You may consider using it.

billc.cn

Posted 2012-01-23T19:22:35.380

Reputation: 6 821

@LarsH wrong, there's an auto-save option when modifying entries which includes adding. See answer by Patrik – Vadim H – 2019-05-24T14:14:55.743

@VadimH: Patrik's answer applies to newer versions of Keepass. I'm glad they added this feature. – LarsH – 2019-05-24T16:17:00.407

4Note, the auto-save option under Advanced only saves "when closing/locking the database." This fulfills the "alternatively" question, but doesn't necessarily "save data after adding new entry." If Keepass or Windows crashes, data will be lost. – LarsH – 2013-04-30T14:25:13.690

36

I ran into the same problem and I wasn't satisfied with the answer so I continued Googling and ran into this tutorial:

How to create a trigger that implements the auto save feature

http://www.mydigitallife.info/how-to-auto-save-the-database-in-keepass-password-safe/

  1. In KeePass Password Safe, click on Tools menu and select Triggers.
  2. Click on Add button to open Add Trigger wizard.
  3. Enter a name for the new trigger, such as Auto Save Database, then click Next. Left the “Enabled” and “Initially On” check boxes ticked, and “Turn off after executing actions (run once) check box unticked.
  4. On the “Events” tab, click on Add button.
  5. Select User interface state updated in the “Event” drop-down list, which evaluates to true when KeePass has finished updating the state of the user interface (menus, toolbar, …), including after most user actions, like adding / editing / deleting entries and groups, etc. Then, click OK, follow by Next in the wizard.
  6. Optional: On the “Conditions” tab, click on Add button.
  7. Optional (if perform step above):Select Active database has unsaved changes in the “Condition” drop-down list, and click OK, follow by Next in the wizard.
  8. On the “Actions” tab, click on Add button.
  9. Select Save active database in the “Action” drop-down list, and click OK.
  10. Click Finish, follow by OK.

The action to save the password is performed immediately, if there is unsaved changes. After creating the trigger, the Save button will always be disabled or grayed out, as the change is saved instantly on any changes – addition, deletion or edition.

Nicolas Thomas

Posted 2012-01-23T19:22:35.380

Reputation: 361

Please import the images into the Stack Exchange Imgur hosting. The hotlink protection is causing the images to not show up. – bwDraco – 2015-08-04T18:40:48.213

This is great - seems like it should be wrapped into an option built into the app! – Peter Tirrell – 2017-11-30T14:31:57.923

1

In KeePass 2.39.1 I can't find the User interface state updated event, but one can use the Time - Periodic event with the condition Database has unsaved changes as in the AutoSave.xml.txt trigger.

– Frank Breitling – 2018-07-23T06:12:24.443

No need to to do this anymore. See answer by Patrik and upvote it – Vadim H – 2019-05-24T14:15:49.440

Thanks for this. In Keepass2 2.38 under Ubuntu 18.04, the auto-save option in Tools -> Options... -> Advanced isn't there - but this trigger seems to work great! – Robert Riedl – 2020-01-08T07:48:41.063

Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

– slhck – 2013-01-22T11:50:07.127

8

2018 Answer (2.39.1+)

In the newest versions of KeePass you can have autosave on any update of the entry (that includes adding new entries) without any triggers. Just go to Tools -> Options... -> Advanced and click on Automatically save after modifying an entry using the entry editing dialog.

Note: This does not seem to work for deleting of entries.

Patrik Fuhrmann

Posted 2012-01-23T19:22:35.380

Reputation: 181

0

The AutoSave.xml.txt trigger from the KeePass Trigger Examples page does exactly this.

To import this trigger see the Importing triggers from a file section on this page.

Frank Breitling

Posted 2012-01-23T19:22:35.380

Reputation: 441

don't need a trigger. See answer by Patrik – Vadim H – 2019-05-24T14:16:13.750