Encrypt Firefox data

This is a little extension to my previous post on encrypting folders. Using the same tools previously created, we will make it easy to store Firefox’s data encrypted, to be automatically decrypted when you run Firefox. This technique should be easily used for other web browsers as well.

Like the previous guide, this may require a little bit of effort to setup. But, once you have it setup, it will be no more hassle to use than running Firefox normally.

I am going to describe two methods, one for people who login to their computers, and the other for people who have auto-login enabled.

Encrypt folder

Simply navigate to the .mozilla folder (Ctrl+H shows hidden folders). In here you should see a firefox folder.

Now right-click and “Encrypt folder” the firefox folder.

Normal Login

If you login to your computer normally, start by encrypting the folder as above.

Now run in a terminal:
gnome-encfs -e ~/.mozilla/firefox
Hit enter to accept the existing settings for the first 3 things, but set mount at login to ‘y’.

Now, whenever you login it will automatically mount the encrypted firefox data, ready for Firefox to use.


Auto-login users have two choices.

The first option, is to use the exact same method as the normal login solution. The drawback of this, is that every time you login (because it will try to mount on login) you will always be asked for your password to unlock the keyring.

The second option will only ask for your password when you try to run Firefox, this allows you to have a system that auto-login’s without any annoying pop-up windows when you start. This option requires a little more setup and maintenance though.

Second Method

First, encrypt the folder as described above.

Next, you need to save a couple of simple scripts:

cd /usr/local/bin/
sudo wget sambull.org/downloads/.firefox_encrypt
sudo chmod +x /usr/local/bin/.firefox_encrypt
sudo wget sambull.org/downloads/fix_firefox
sudo chmod +x /usr/local/bin/fix_firefox

Now run the latter script: sudo fix_firefox

This script simply renames the firefox program to firefox-dc, then creates a link, so whenever anything tries to run Firefox, it will actually run our little script. Our script then mounts the Firefox data and launches the real Firefox.


Just launch Firefox as you normally would, if your keyring hasn’t been unlocked yet you’ll be prompted for the password to unlock, and then Firefox will launch as normal.


One drawback of this method is that it requires a little bit of maintenance. Whenever the system updates Firefox, it is going to overwrite the link we made earlier. This is why we saved fix_firefox as a script, we now need to run this script everytime Firefox is updated.

Fortunately, we can automate this. Simply run:

sudo gedit /etc/apt/apt.conf.d/70debconf

and add a new line:


Now, after a reboot, it will run our script everytime the computer is updated.

One thought on “Encrypt Firefox data

Leave a Reply

Your email address will not be published. Required fields are marked *