KeePass 2 Done Right: Key File, Auto-Type, Backups
Four upgrades that turn a plain password vault into a setup you can actually trust for years.
You know the moment. A site wants you to log in again, the browser has forgotten everything, and your brain offers up three half-remembered passwords that all end in the same digit. KeePass fixes that, but only if you set it up properly. A vault with a weak master password and no backup is just a single point of failure with a padlock icon.
This guide walks you through the four things worth doing in KeePass 2 (current version 2.61.1): a second key factor, Auto-Type that hits the right window, backups that happen without you, and a password generator tuned to your taste.
Step 1: Add a key file to your master password
A master password is something you know. A key file is something you have. Combine both and an attacker who copies your database file still has nothing useful, because the second half of the key sits elsewhere.
- Open your database and choose File > Change Master Key....
- Enter your master password twice (keep it or pick a stronger passphrase while you are here).
- Tick Show expert options.
- Tick Key file/provider and click Create... to generate a fresh key file. KeePass 2 creates an XML key file by default, typically with the extension .keyx.
- Save the key file somewhere that is not the database folder, ideally a USB stick you keep with you.
- Click OK. KeePass offers to save the database right away and asks whether you want to print a new emergency sheet. Say yes to both.
The key file must never be edited, not even opened and saved in a text editor. Change one byte and the database stays locked forever. Make a second copy on separate storage, and for extra peace of mind print a paper backup via File > Print > Print Key File Backup.... If the stick ever dies, KeePass can rebuild the key file from that printout.
Leave Windows user account unticked unless you really know what you are doing. That option ties the database to your exact Windows account, and a reinstall or a broken drive can lock you out for good.
Step 2: Let Auto-Type do the typing
Copying and pasting passwords works, but it leaves secrets on the clipboard. Auto-Type sends simulated keystrokes instead. The default sequence types the user name, presses Tab, types the password and presses Enter.
Right-click an entry and pick Perform Auto-Type, or press Ctrl+V.
There are two ways to fire it:
- Click into the user name field of the login form you want to fill.
- Switch to KeePass, right-click the entry and choose Perform Auto-Type, or select it and press Ctrl+V. KeePass jumps back to the previous window and types.
The faster route is the global hotkey. Put your cursor in the login form and press Ctrl+Alt+A without touching KeePass at all. It then reads the title of the active window and picks every entry whose title appears in that window title. So name your entries sensibly: an entry called "Amazon" matches any browser window with "Amazon" in its title. If several entries fit, you get a short selection list.
Some sites have bland window titles like "Welcome" or use a two-page login. For those, open the entry, go to the Auto-Type tab and use Use custom sequences for specific windows. Click Add, fill in the Target window (wildcards like * are allowed), choose Use custom keystroke sequence and type something like {USERNAME}{ENTER} for the first page. While you are on that tab, tick Two-channel auto-type obfuscation, which makes life harder for keyloggers.
If nothing gets typed into an app, it probably runs with higher privileges than KeePass. Starting KeePass with Run as administrator solves that for apps running with admin rights. You can change the hotkey under Tools > Options > Integration.
Step 3: Automatic backups with a trigger
There is no "backup" checkbox, but there are triggers, which are small if-this-then-that rules. This one copies your database to a backup folder with a timestamp every time you open it.
- Create the backup folder first, for example C:\Backup. The copy command fails if the folder is missing.
- Choose Tools > Triggers... and click Add.
- Give it a name like "Back up on open" and tick Enabled and Initially on.
- On the Events tab, add the event Opened database file.
- On the Actions tab, add Execute command line / URL.
- In File/URL enter %comspec%
- In Arguments enter: /c copy "{DB_PATH}" "C:\Backup{DB_BASENAME}.{DT_SIMPLE}"
- Confirm with OK.
From now on, each time you open the vault, a copy named after the database plus date and time lands in the folder. If your vault lives on a USB stick and you don't want copies on random PCs, swap C:\Backup for {DB_DIR} so the backup stays next to the original.
The folder grows over time. The official trigger examples include a second action that deletes all but the newest seven copies; for a quick start, simply clean the folder by hand every few months. Store at least one copy off the PC too, on an external drive or in cloud storage. The database is encrypted, so that is safe as long as the key file does not travel with it. For a manual one-off backup, File > Save As > Save Copy to File... does the job.
Step 4: Tune the password generator
Open the generator via Tools > Generate Password... or with the generator button next to the password field in any entry.
Character set mode with length and character groups is the recommended way to generate passwords.
- Keep Generate using character set selected. It produces truly random passwords and is the method the KeePass help recommends.
- Set Length of generated password to 20 or more.
- Tick Upper-case, Lower-case, Digits and a couple of the symbol groups such as Special or Minus.
- Check the Preview tab to see sample results before you commit.
Some sites reject certain symbols or limit length. Rather than fiddling every time, save the settings as a profile with the save button next to Profile, then pick it from the drop-down when needed. A neat trick: overwrite the profile named "(Automatically generated passwords for new entries)" and every new entry starts with a password in your preferred format.
Generate using pattern handles fussy rules ("exactly two digits, two upper-case letters..."). If you use it, tick Randomly permute characters of password, otherwise the characters always appear in the same order. Options on the Advanced tab such as Exclude look-alike characters are handy for passwords you have to type by hand, but they shrink the pool of characters. The app flags that with an exclamation mark on the tab.
Our verdict
KeePass rewards people who like control: no cloud account, no subscription, and every security decision in your hands. The flip side is that nobody backs anything up for you. If you only do one thing today, set up the backup trigger from Step 3 and put a second copy of your key file on a separate drive. Everything else can wait for a rainy weekend.

