Import passwords from Firefox to Pass
Summary
- Introduction
- Extracting passwords to Firefox
- Importing password to pass
- Enjoy your passwords everywhere
Introduction
I going to travel but I'm going to travel in the next weekend, So I wanted to access the password from firefox, but I don't to use firefox sync, so instead I use pass which is my main software to store passwords for several reasons:
- I don't need firefox to access my passwords
- Every device with gpg and git support can read these passwords(eg. my smartphone)
So I (poorly) searched on google how to do this but couldn't found one way
Extracting passwords from firefox
First you must access logins page, there are two ways:
- Writing
about:logins
in your address bar and hitting enter - Through firefox
Menu
>Passwords
Now you will see a screen like that, all you have to do is to access the menu on the top right corner and click in Export accounts
and save the CSV file generated by Firefox.
Importing passwords to pass
After that, you need to run a script to parse the generated csv file and send to pass insert
command.
You don't need to thinkering about this, I've already made the script with every line commented case you are unfamiliar with these commands:
cat accounts.csv | # Obs: Note this is the filename generated by Firefox that I saved as accounts.csv
sed -e 's/","\|",\|,"\|,,/@@@/g' | # Parse csv file (considering quotes) and outputing a new delimiter (@@@)
sed 's/https:\/\///g' | # Remove 'https://' (In my opinion this makes the pass output ugly). You can remove this line safely
sed 's/\"//g' | # I can't figure out how to remove `"` from the output, so I need this line to remove remaining quotes
parallel -P 1 --colsep '@@@' "echo {3} | pass insert -m firefox/{1}/{2}" # Run command parsing the delimiter `@@@`.
You can use this script every time to refresh existing passwords into pass.
Script Notes
In this case I choose parallel because of --colsep
argument, which make things easier. You have to run with -P 1 because of insert .index lock file.
Sorry for my bad sed/regex skills, but this is the best I can do in the moment. I'm sure someone know how to do this in one command.
Enjoy your passwords everywhere
After that, all of your extracted passwords can be accessed by using pass firefox
command or pass firefox/domain/user
. You probably know how pass
works so I don't need to dig into that.
Now I can go to my travel and access passwords from my private git repository without any worries of forgetting to save any password.
Hope you find this article useful, feel free to contact me through my e-mail (In the socials links below) if you find interesting to change something here.