1. Home
  2. Linux

How To Back Up A Thunderbird Profile On Linux

Linux users who use the Thunderbird email client know that the program doesn’t have a built-in method for backing up entire profiles on Linux. As a result, users looking to keep a steady backup of emails and user account data have to search for an outside solution to back up a Thunderbird profile.

SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.

Backup A Thunderbird Profile

Luckily, the solution isn’t very complicated, as all of the program’s user data is in a single folder in /home/. If you’d like to keep all of your configured add-ons and accounts you’ll need to move some files around. To start off with the backup, you’ll need to open up a terminal window. From here, use the tar command to create a complete bz2 archive of the ~/.thunderbird folder.

Note: The Thunderbird Email program sets up profiles in /home/. If you’d like to back up multiple user profiles, you’ll need to log into every user’s account and run the compression command.

tar -jcvf thunderbird-email-profile.tar.bz2 .thunderbird

Compression is usually pretty quick. In some cases, it may take a long time, especially if you’ve got a lot of data in your profile. When the compression is complete, you’ll see a file named “thunderbird-email-profile.tar.bz2”. This archive contains all email account data, add-ons, etc. about your Thunderbird email client. Feel free to take this archive and upload it to your Dropbox, Google Drive, or even a home file server.

Keep in mind that this archive is wholly unprotected, and if it falls into the wrong hands, anyone could have instant access to your old emails and various accounts. Later on in this article, we’ll be going over how to encrypt and store this data correctly. If you do not intend on encrypting your backup, please, at least use a secure password for the account and do not share the archive with anyone!

Encrypting The Backup

There are many ways to encode your Thunderbird backup, but probably the best way is to use GnuPG. It’s the standard encryption tool on all of Linux, and you probably already have it installed on your Linux computer. To use it, open up a terminal window and type “gpg.”

Entering “gpg” in the terminal without anything else will warn you that you “didn’t supply a command.” Using GPG without any command arguments is OK. Doing it lets you know that you’ve got GPG on your PC. If you don’t, look in your package manager (or however you install software on your Linux operating system) and search for “gpg” or “GnuPG” and install it.

Next, enter this command to encrypt your profile backup.

gpg -c thunderbird-email-profile.tar.bz2

Running this command will show a prompt that asks the user to enter a password. Be sure to use a secure, memorable passcode that nobody will be able to guess easily.

When the file is fully encrypted, delete the source file, as thunderbird-email-profile.tar.bz2 is now thunderbird-email-profile.tar.bz2.gpg.

rm thunderbird-email-profile.tar.bz2

When the encryption process is complete, your backup data is safe, and nobody but you can access it. Feel free to upload it anywhere.

Decrypting The Backup

Encryption and decryption with GnuPG work roughly the same way, in that the user needs to supply a command and a password to lock or unlock files. To decrypt the GPG file on your Linux PC, open up a terminal window and use the CD command to move to the folder where the backup is located. In this example, it is in /home/.

cd ~/

Inside the /home/ directory, use the ls command to make sure that the thunderbird-email-profile.tar.bz2.gpg file is there. If the file is not in this directory and has moved consider doing this command to find it:

locate thunderbird-email-profile.tar.bz2.gpg

Using the gpg command, decrypt the locked file.

gpg thunderbird-email-profile.tar.bz2.gpg

When decryption completes, rerun ls to reveal the decrypted archive. Your /home/ folder should how have both  thunderbird-email-profile.tar.bz2.gpg and thunderbird-email-profile.tar.bz2.

Feel free to extract thunderbird-email-profile.tar.bz2, and delete the thunderbird-email-profile.tar.bz2.gpg file if you no longer want it locked away. Otherwise, keep both, and delete the tar.bz2 archive when done using it.

Restoring Backup

After decrypting the Thunderbird archive, you may want to restore the backup. Keep in mind that if you’re doing this on a new computer, you may need to delete the .thunderbird directory that’s already there.

Note: deleting this folder is necessary, as a lot of Linux distributions that choose to ship Thunderbird may have this folder.

To delete it, run this command:

rm -rf ~/.thunderbird

When you’ve removed the default profile folder, extract your backup.

tar -xvf thunderbird-email-profile.tar.bz2

Everything should extract inside a .thunderbird directory in /home/. If it doesn’t, use mv to move it out of the parent folder (if it happens).

cd ~/thunderbird-email-profile

mv .thunderbird ~/

rm thunderbird-email-profile

Leave a comment