After seeing lots of positive feedback on HN about the Bitwarden password manager, I finally decided to try it out. Because I had over 1,000 accounts in LastPass, many of which were crufty, I wanted to declare "account/password" amnesty while still keeping all the old account information "just in case." Here is how I migrated my LastPass database to Bitwarden.
About half of my accounts in LastPass were assigned to a "group", which somewhat helped
contain account sprawl. This also means that the other half were not in any group. I
wanted to bring these in to Bitwarden, but sequester them so that they did not pollute
the "clean slate" I wanted to start with. To that end, I decided that I wanted to
import all LastPass data into a Bitwarden folder named
old. If any LastPass data was
in a group, I wanted that data to appear in Bitwarden under
Turns out, this is pretty easy to do.
When your LastPass data is exported as a
csv file, it contains a column named
grouping, which contains the group which contains the entry, if any. I wrote a simple
python script that read the exported LastPass
csv, prepended the string
old/ to the
grouping, and printed the results to
# file: lpgrp.py import csv import os import sys csv_in = os.path.expanduser('~/Documents/secrets/lastpass/2018-11-12-export.txt') csv_out = sys.stdout writer = None with open(csv_in, 'r', newline='') as csvin: with open(csv_out, 'w', newline='') as csvout: reader = csv.DictReader(csvin) for row in reader: if writer == None: writer = csv.DictWriter(csvout, fieldnames=row.keys()) writer.writeheader() if row['grouping'] == '': row['grouping'] = 'old/none' else: row['grouping'] = 'old/' + row['grouping'] row['grouping'] = row['grouping'].replace(' ', '') writer.writerow(row)
Here's how to do the import:
old/ to all LastPass items:
python lpgrp.py > bw-import.csv
. Create a top-level folder in Bitwarden named
old. You can do this with either of
* Use the web interface to manually create the
* Use the Bitwarden cli to create the
export BW_SESSION="your session key"
bw get template folder | jq ".name = \"old\"" | bw encode | bw create folder
. In Bitwarden, import the file created in step 1.
Once the import completes, the LastPass account data is in a folder hierarchy in Bitwarden. This makes it quite easy to pick through old accounts on an as-needed basis and move them to a current folder hierarchy.