When we prompt our browser to save credentials once we log into a web application, they store our corresponding username and password. I know to recover these things from my browser. But I want to know to which directory in Ubuntu these passwords are stored?
Chromium and Chrome
Store passwords in three ways:
Chromium chooses which store to use automatically, based on your desktop environment.
Passwords stored in GNOME Keyring or KWallet are encrypted on disk, and access to them is controlled by dedicated daemon software. Passwords stored in plain text are not encrypted. Because of this, when either GNOME Keyring or KWallet is in use, any unencrypted passwords that have been stored previously are automatically moved into the encrypted store.
Source for Chromium.
The manual page for google chrome (
man google-chrome
) shows:Chrome uses the same method as Chromium. And you can use above setting to switch to plain text passwords (not recommended of course).
Chrome (older versions)
Passwords are stored in
~/.config/google-chrome/Default/Login\ Data
and that is a sqlite database file (that file is encrypyed).This login database file is in SQLite format which is lighter version of popular SQL database. In addition to login credentials it also stores other information such as auto complete entries, IE7 Logins, search keywords etc. The 'logins' table is where all the login or sign-on secrets are stored by Chrome. This table contains following interesting fields
Except the password field all other fields are entered in clear text. The password for all stored websites is encrypted using Triple DES algorithm seeded with logged on user's password. That means login secrets cannot be decrypted across the user or system boundaries unless under certain conditions.
Source for Microsoft Windows.
Firefox
See
~/.mozilla/firefox/<profilename>
Your passwords are stored in the key4.db and logins.json files.
Source.
Ubuntu 20.10 Chromium stores passwords at
~/snap/chromium/common/chromium/Default/Login Data
The following two thing have changed since the answer Where are my browser passwords stored? was written:
~/snap/chromium/common/chromium/Default/
rather than the old~/.config/chromium
One easy way to test this out is to create a new login on some website that you had not signed up for, e.g. I chose https://www.onlylads.com/
Then, after Chromium asks you to save the password and you agree, quit Chromium to unlock the database, and do:
and this now contains an entry of type:
which confirms that it stores an encrypted password, with other fields being plaintext.
We can also get the corresponding schema with:
which gives:
I then also observe that under "Passwords and Keys", which is the:
GUI frontend for GNOME key ring, that there is a Chromium entry:
which is presumably contains the key to decrypt the passwords in the database.
That GUI also showed all my old passwords left over from previous Chromium versions, which I now nuked (and then had to reset the password database because I also nuked the Chromium key by mistake, but Google autosync saved me :-) https://superuser.com/questions/573602/chrome-not-saving-passwords-and-not-auto-filling-existing-login-passwords/1325741#1325741 )
This gets automatically unlocked at login time.
Some interesting reminders:
Tested on Ubuntu 20.10, Chromium 88.0.4324.150 snap.