M y    b r a i n    h u r t s  !                                           w e                 r e a l l y                 t h i n k                   w h a t                y o u             k n o w

Apr 14, 2012

Linux: How to export Google Chrome passwords to CSV file

Having spent some time googling for a way to export Chrome passwords to an external file to my surprise I could not find a straightforward solution that would work irregardless of the version of Chrome/Chromium. Finally I have found this page which provided the key to the solution.

Older versions of Chrome/Chromium for Linux stored unencrypted passwords in an SQLite database under:

    ### Google Chrome:
    ~/.config/google-chrome/Default/Login Data

    ### Chromium:
    ~/.config/chromium/Default/Login Data

In newer versions of Chrome this file is still present, but the passwords are not there anymore - they are stored using the encrypted password storage provided by the system, either Gnome Keyring or KWallet, which means that simply dumping the tables will not work.

The method below relies on forcing Chrome to use a temporary profile folder in combination with unencrypted password storage. This approach will not affect your current Chrome profile in any way.

So, to export your passwords to a human readable text file:

  1. Connect to your Google Account in Chrome Settings so that your passwords are synched with the Google cloud storage. Make sure that you have ticked Passwords in Advanced Sync Settings.
  2. Wait for a while until the data is synched, and then close all the Chrome windows.
  3. Start Chrome using one of the two command lines below. The easiest way to figure out whether you are using Google Chrome or Chromium is to look at the icon — Google Chrome has a green-red-yellow icon , while the Chromium icon is in shades of blue . To be absolutely sure, click the spanner icon in the top right corner and select About Chrome/Chromium.
        
    ### Google Chrome
        google-chrome --user-data-dir=/tmp/chrome-tmp --password-store=basic
    
    ### Chromium
        chromium --user-data-dir=/tmp/chrome-tmp --password-store=basic
    
    This will launch Chrome with a custom profile folder without affecting your current profile.
  4. Setup Google Synching for the new temporary profile and wait three or four minutes until everything is synced from the cloud, i.e. your bookmarks appear, extensions show up, the theme is applied, etc. Verify that the passwords are restored from the Google cloud by looking under Settings → Personal Stuff → Manage Saved Passwords. If they do not appear, then wait a couple of minutes more. Note: the fastest way to get to the stored passwords page in settings is to type password in the Search box in the top right.
  5. Exit Chrome.
  6. Next, open a terminal and change to the newly created Chrome profile
    cd /tmp/chrome-tmp/Default
    
  7. Now, open the Login Data SQLite database using the sqlite3 command line utility and dump the logins table. For this to work, you need to have sqlite3 installed on your system.
    sqlite3 'Login Data'
    
  8. Next, at the SQLite prompt enter the commands below. For help on available commands type .help at the prompt.
    .mode csv               # other options are `html', `tabs', etc.
    .headers on
    .separator ","
    .output chrome_passwords.csv
    select * from logins;
    .exit
    

Now you should have a file named chrome_passwords.csv containing all your Chrome passwords. To open it with LibreOffice, type:

libreoffice --calc chrome_passwords.csv

4 comments:

  1. Just great.

    I've been searching for a solution 15 minutes and even tried to use a Windows tool with WINE - your solution took me exactly 1 minute and I've got my passwords back, even well formatted in an .csv file.

    Thank you very much.

    PS: I'm new to Linux and the Terminal but you managed to make it easy even for a n00b :-)

    ReplyDelete
  2. wow! thank you so much!

    ReplyDelete
  3. The downside of this solution is that you share all your passwords with Google...

    Does anyone know any other way to decode Google Chrome entries in KWallet/Gnome Keyring?

    ReplyDelete

The Java Posse (Most Recent Podcasts)