How to back up your Dropbox settings on Linux
Are you sick of having to log into Dropbox on every single Linux PC you set up sync on? Want just to restore a backup and get going? Follow along with our guide on to back up your Dropbox settings on Linux to learn how to do just that!
Backing up Dropbox configuration on Linux
All Dropbox configuration files for Linux are stored in the ~/.dropbox
folder. If you’re trying to back up your Dropbox settings, you’ll need to save all of that data for that folder.
Note: The Flatpak Dropbox also uses the ~/.dropbox
folder, so no need to back up individual folders in ~/.var
.
To start the backup process, open up a terminal window on the Linux desktop. To do that, press Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, once the terminal window is open on the desktop, use the ls command to view the contents of your home folder.
ls -a
Or, for an easier time, try running the ls command in combination with the grep command.
ls -a | grep .dropbox
By running the ls command, you’ll be able to see all folders and files (both hidden and visible). Look through to see if you can find the ~/.dropbox
folder. You need to confirm that the ~/.dropbox
folder is indeed there because if it is not, there’s no way to back up your Dropbox settings.
If you cannot find the ~/.dropbox
command, log into the Dropbox app on your Linux system and allow it to sync everything down to your PC. Once you’re logged into Dropbox, the ~/.dropbox
folder will appear.
When you’ve confirmed that the ~/.dropbo
x folder is where it should be on your Linux system, follow the instructions below to learn how to create a compressed TarGZ backup.
Compressing your Dropbox backup
You must compress the ~/.dropbox
folder to save all of your settings. The easiest way to create a compressed backup is by using the tar command to create a TarGZ archive file.
To create a TarGZ archive of your Dropbox profile, run the following tar command in the terminal window.
tar -czvf my-dropbox-settings.tar.gz .dropbox
After running the tar command above, the terminal will start to compress the ~/.dropbox
folder. It will also compress all of the contents of the folder. This compression process should be quick, as the files are not very large. However, if you have a slow PC, you may need to wait a couple of seconds.
When the compression process is complete, you will see a TarGZ file in your home directory with the name of my-dropbox-settings.tar.gz
. At this point, you can take my-dropbox-settings.tar.gz
and upload it to your cloud storage solution of choice, or place it on an external USB device. However, be warned that it is not encrypted, and anyone can tamper with it.
Encrypting Dropbox configuration on Linux
Your Dropbox backup is complete, but it is not encrypted. Encrypting your backup will keep your Dropbox information safe. To start the encryption process, you must install the GPG tool. To install GPG, open up a terminal window, and enter the commands below.
Ubuntu
sudo apt install gpg
Debian
sudo apt-get install gpg
Arch Linux
sudo pacman -S gpg
Fedora
sudo dnf install gpg
OpenSUSE
sudo zypper install gpg
Once the GPG tool is installed, you can encrypt your backup using the gpg -c command below. Keep in mind that when you use the gpg -c command, you should use a strong, memorable password. If you do not use a strong password, your encryption will be for nothing as it will be easy to guess.
gpg -c my-dropbox-settings.tar.gz
When the encryption is finished, delete the unencrypted file with the rm command.
rm my-dropbox-settings.tar.gz
Then, move the encrypted backup to the home directory using the mv command.
mv my-dropbox-settings.tar.gz.gpg ~/
From here, feel free to back up the encrypted backup to a cloud storage provider or removable USB hard drive/USB flash drive.
Restoring the backup
To restore the Dropbox backup, place the my-dropbox-settings.tar.gz.gpg file in your home directory. Then, open up a terminal window and follow the step-by-step instructions outlined below.
Step 1: Decrypt your backup. To decrypt your backup, run the gpg command in a terminal.
gpg my-dropbox-settings.tar.gz.gpg
Upon entering the gpg command in a terminal window, you will be asked to enter your encryption password. Do so to decrypt the backup.
Step 2: When the backup is decrypted, delete the existing .dropbox
folder using the rm command.
rm -rf ~/.dropbox
Step 3: Decompress the unencrypted backup using the tar xvf command in a terminal window.
tar xvf my-dropbox-settings.tar.gz
When the TarGZ archive file is fully extracted, your Dropbox files will be restored. From here, you can delete the unencrypted backup for security purposes using the rm command below.
rm my-dropbox-settings.tar.gz