KeePass has the option for a master password and key file (and windows login). But I am not sure how it really helps security that much.

I can see a couple of scenario's:

  1. The database and key are on one system: basicly a open door.
  2. The PC is yours and the datbase is on it, and the key is on a usb stick: secure as long as your system it not compromised.

So only if you use a USB Stick it's secure-ish. But it isn't (meaningfully) more secure than just having a password right? Remembering a single complex password is quite possible. And if it takes over a lifespan to bruteforce the complex password, it's not that meaningful that the keyfile has a longer and more complex password, right?

And if the system is compromise it doesn't really matter either way. Only one time password could protect against that.

So am I getting this completely wrong and is the keyfile in fact more secure? Or is it more of a thing where some people prefer sticking a USB stick in their PC instead of typing a password?

And lastly, since you can use both, is there any point to having both a keyfile and master password if I am unwilling to plug the USB stick in and out (thus leaving the keyfile on the harddrive (or letting the USB stick stay connected 24/7)? Or would that render it nothing more than a little security through obscurity?

  • As the documentation states, it can serve as a complete replacement of remembering a password. Combining them eliminates the risk of people reusing passwords elsewhere, and choosing passwords based on personal details. But a long, random password is better than just a keyfile because it is easier to keep secret.
    – J.A.K.
    Feb 4, 2019 at 0:21

1 Answer 1


The keyfile for KeePass is just another kind of passphrase, as it is stated in the Keepass Documentation:

A key file is basically a master password in a file. Keyfiles are typically stronger than master passwords, because the key can be a lot more complicated; however it's also harder to keep them secret.

The keyfile is more something you have (though it might be copied by adversaries), and a password is something you know. So by combining both you might gain some extra security in some scenarios. If an attacker has the database and gains knowledge of your password by shoulder surfing, the additional keyfile on your USB will keep you somewhat safer.

Storing the keyfile on the hard drive of the computer as well will not really increase security, as the documentation correctly states:


[...] The point is not to keep the location of the key file secret – selecting a file out of thousands existing on your hard disk basically doesn't increase security at all, because it's very easy for malware/attackers to find out the correct file (for example by observing the last access times of files, the recently used files list of Windows, malware scanner logs, etc.). Trying to keep the key file location secret is security by obscurity, i.e. not really effective.

However you are correct, if your computer is compromised, password and keyfile will at some point be accessible for an attacker and therefore need to be considered as insecure in this scenario.

  • 1
    Your last paragraph only applies if you are unaware that your computer is compromised. If your computer is compromised by being permanently stolen, the attacker is unlikely to gain access by waiting for you to plug in your USB.
    – Fax
    Oct 2, 2020 at 13:26

You must log in to answer this question.