1. Home
  2. Linux
  3. Back up firefox snap settings

How to back up Firefox Snap settings on Linux

If you are a Snap Firefox user, you might notice that your profile information isn’t in the usual place. Why is this? The Snap release of Firefox does not interact with the folder that Mozilla Firefox usually creates on Linux to manage profiles. The reason for this is that Snaps are sandboxed applications. They cannot interact with every part of the file system and are made to self-contain themselves.

Back up Firefox Snap settings

If you’re a Snap Firefox user, your profile information is stored inside of the ~/snap/firefox directory. To make a backup of this profile information, start by opening up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the step-by-step instructions outlined below.

Step 1: Using the terminal window, CD into the ~/snap directory. This directory resides in your home folder and holds all Snap-related configuration files. You need to be in this directory to make a backup of your Firefox profile information.

cd ~/snap

Step 2: Once inside of the ~/snap directory, run the ls command. The ls command will allow you to take a look at what is inside of the folder you’re currently in. We need to determine if there is a firefox folder inside of ~/snap.

ls

Do you have too many sub-folders in the ~/snap directory? Run the ls command alongside grep to filter out exactly what you need.

ls | grep firefox

If you do not see the firefox folder appear after running the ls command, the Snap release of Firefox is either not installed, or is not working correctly. Please take the time to re-install the Firefox Snap, and sign in to your Firefox account to set up a profile.

Step 3: After confirming that there is a firefox folder in the ~/snap directory, the backup can begin. Using the tar command, create a TarGZ archive of the folder. Keep in mind that when creating this archive, compression can take time. Be patient!

Note: be sure to close the Firefox app on your system before attempting to create a backup. If the browser is running, there could be temporary files being created that could mess with the compression process.

tar -czvf my-firefox-backup.tar.gz firefox

Step 4: When the backup is complete, you can take the backup file and upload it to Dropbox, Google Drive, or place it on a USB flash drive or USB hard drive. However, doing so is irresponsible, as it is not encrypted. For this reason, we will now go over how to encrypt your backup.

Encrypt backup

To encrypt your backup, use the following gpg command below in a terminal window. Be sure to use a secure, memorable password! A weak password is easy to guess and will render your encryption useless.

gpg -c my-firefox-backup.tar.gz

The encryption is complete. Delete the unencrypted backup from the ~/snap folder as it is no longer needed. To delete, run the rm command below.

rm my-firefox-backup.tar.gz

Place the encrypted GPG backup file in the home directory (~) with the mv command.

mv my-firefox-backup.tar.gz.gpg ~/

Once the GPG backup file is in the home directory, take it and store it in a safe location!

Restoring the backup

Restoring your Firefox Snap backup is very easy. All that you need to do is decrypt the backup and extract the contents of the TarGZ archive to the ~/snap folder. To start the restoration process, open up a terminal window and follow the step-by-step instructions down below.

Note: the Firefox Snap app must be closed during the backup restoration process!

Step 1: Using the CD command, move the terminal session from your home directory to the ~/snap folder.

cd ~/snap

Step 2: Inside of the ~/snap folder, you will need to delete the existing Firefox folder. To delete the existing Firefox folder, make use of the rm command below.

rm -rf firefox

Step 3: After deleting the firefox folder, move the encrypted backup file to the home directory. Then, decrypt it using the gpg command.

gpg my-firefox-backup.tar.gz.gpg

The decryption should only take a couple of seconds. When the decryption process is complete, you will see my-firefox-backup.tar.gz in the home directory.

Step 4: Once the Firefox backup is decrypted, you must move the unencrypted backup into the ~/snap folder. Using the mv command below, place the unencrypted Firefox backup archive in ~/snap.

mv my-firefox-backup.tar.gz ~/snap

Step 5: Decompress the Firefox backup using the tar xvf command.

tar xvf my-firefox-backup.tar.gz

When the backup is decompressed, your Firefox Snap’s profile information will be restored. Feel free to open up Firefox and use it! However, remember to run the rm ~/snap/my-firefox-backup.tar.gz command to delete the unencrypted backup file, as someone could gain access to your profile information!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.