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
Why can’t I just copy the default profile and then when I’m ready to restore, just copy its files back into the current profile directory?
In this backup, that is what you are doing, but it is compressed so that it is easier to transfer or upload to a cloud service or server. You don’t have to compress if you don’t want to.
Hi Derek,
Thanks for this informative tips on using and maintaining the emails in Thunderbird. Especially for Linux. I seem to have difficulty in finding such tutorials especially for Linux users.
I wish there would be a good site for knowledge base info on Thunderbird mainly for Linux users.
Neways, I wonder if you could update on whether Thunderbird is capable of archiving or backing up emails for single email account rather than the whole profile?
Much appreciated. I am all for the Open source movement especially for Linux. Thanks.
I will make a follow-up article on how you can back up individual emails in Thunderbird very soon! Thanks for the comment.
This may have worked in 2018, but does not work in the current version of TB.
Backing up the ~/.thunderbird profile still works. All Email data is saved in that folder on Linux, so you should still be able to create the backup.
Wow – works like a dream; I think I have around 20k + emails on Thunderbird; with a profile size of >11 GB! And it was no problem transferring to a new computer!
btw, wasn’t clear to me, obviously, when you transfer the profile you also transfer your login details so Thunderbird will start downloading the new emails that have arrived since you performed the backup. so if this is an issue, disconnect internet from the computer you are transferring to.
Nice – the bz2 archive is significantly compressed, almost half the size compared to the original Thunderbird profile, which in my case was >11 GB, so to have this compressed is very helpful!
BTW – a nice Windows programme (sorry for mentioning this ) for archiving emails is Mailstore; which is free for personal use.