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.

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.


The next steps will setup your system such that opening Firefox will try to unlock your keyring and mount the folder before launching (asking for your password if the keyring is still locked), this allows you to have a system that auto-login’s without any annoying pop-up windows when you start.

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

  1. [2020-09-06] – Changed instructions to work with new ecryptfs extension.
    [2013-04-01] – Changed instructions to work with new encryption extension.

Leave a Reply

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