2 Easy Ways to Encrypt Dropbox on Ubuntu 16.04/17.10 (Desktop & Server)

This tutorial shows you 2 ways to encrypt Dropbox on Ubuntu 16.04/17.10. This will be very helpful for those who are worried about privacy and security when storing files on cloud storage providers. Experienced Linux user can set up their own cloud using NextCloud, but not everyone has the skill or time to manage a self-hosted cloud. When your Dropbox files are encrypted, no one can see them without the encrypting password.

The first method uses a graphical tool for desktop users and the second uses a command line tool, which is suitable for servers.  If you haven’t installed Dropbox on Ubuntu yet, please check out the following tutorials.

These two tools can also be used to encrypt other cloud storages like Google Drive and NextCloud.  I use Dropbox as an example.

Using Cryptomator to Encrypt Dropbox on Ubuntu 16.04/17.10 Desktop

Cryptomator is a free, open-source and easy-to-use software for encrypting cloud storage. It uses client-side encryption, which means each file is encrypted on the user’s computer before sending to the cloud. File content, file name, file size and directory names will all be encrypted.

It can run on Linux, Mac, Windows, Android and iOS. To install Cryptomator on Ubuntu 16.04 and Ubuntu 17.10, run the following 3 commands in terminal, which will install Cryptomator from the developer‘s PPA.

sudo add-apt-repository ppa:sebastian-stenzel/cryptomator

sudo apt update

sudo apt install cryptomator

cryptomator ubuntu 16.04

Once installed, Cryptomator can be started from your application menu.

cryptomator dropbox

Or you can start it from the command line.

cryptomator.sh

When you first start Cryptomator, there is no vault. A vault is basically a virtual hard drive. So we need to click the plus button at the bottom left and create a vault.

dropbox encryption

A new window appears. Give your vault a name and choose your Dropbox folder as the destination.

cryptomator ubuntu 17.10

Next, set a password to protect your vault.

cryptomator create new vault

Re-enter your password to unlock the vault.

dropbox encryption

The vault will be mounted as a virtual hard drive (localhost:42427).

dropbox encryption ubuntu

Now you can put your files in the vault and they will be automatically encrypted on the background and then stored in your Dropbox folder, which is then synchronized to Dropbox servers. For example, I put 3 png files in the vault.

cloud storage encryption

Here is how they look like in Dropbox.

encrypt dropbox ubuntu

Once your encrypted files are synchronized to Dropbox servers, you can lock your vault.

cryptomator lock vault

Once it’s locked, the virtual hard drive disappears from your file manager, so no one can see the original files without password.

How To Access Encrypted Files on Another Computer

Install Dropbox and Cryptomator on the second computer. Wait for Dropbox to finish syncing. Then start Cryptomator on the second computer and select “Open Existing Vault“.

cryptomator open existing vault

Navigate to the Dropbox folder and select the Cryptomator masterkey.

cryptomator masterkey

The master key is encrypted with your vault password. So now you need to enter your vault password to decrypt the key, which in turn will unlock the encrypted vault.

cryptomator decrypt masterkey

If you want to share encrypted files, then create a separate vault with a different password and let your family, friends or coworkers install Crypmator and then tell them the password. Currently there’s no command line version of Cryptomator. That’s where CryFS comes in.

Using CryFS to Encrypt Dropbox on Ubuntu Server & Desktop

CryFS stands for cryptographic filesystem. It is a free, open-source encryption tool created specifically for cloud storage. It usage is very similar to Cryptomator and can encrypt file contents, file name, file size and directory structure.

CryFS is included in Ubuntu repository since 17.04, so Ubuntu 17.04/17.10 users can install CryFS by running the following command in terminal.

sudo apt install cryfs

Ubuntu 16.04 users need to install CryFS from its repository. First, create a source list file for CryFS.

sudo nano /etc/apt/sources.list.d/cryfs.list

Then add the following line into the file.

deb http://apt.cryfs.org/ubuntu xenial main

cryfs linux

Save and close the file. Next, download and import CryFS public key using the following command.

wget -O - https://www.cryfs.org/apt.key | sudo apt-key add -

Update package index and install CryFS.

sudo apt update

sudo apt install cryfs

To create encrypted vault in Dropbox, run the following command.

cryfs ~/Dropbox/encrypted ~/mountdir

This will create two directories. ~/Dropbox/encrypted is where encrypted version of your files are stored. They will be synchronized by Dropbox. ~/mountdir is where plain files are stored. You will be asked to create a password.

cryfs encypte dropbox

Now you can put files in mountdir directory and they will be automatically encrypted on the background and then stored in ~/Dropbox/encrypted/ directory.  If I create a plain text file in ~/mountdir using the following command,

[email protected]:~$ echo "hello world" > ~/mountdir/file

The file content, file name, file size and directory structure will be encrypted in Dropbox folder.

[email protected]:~$ ls ~/Dropbox/encrypted/A60/
8EB642B7806A722005C45A7BBACD0

To unmount, run:

fusermount -u ~/mountdir

To remount, run the following command and enter your password.

cryfs ~/Dropbox/encrypted ~/mountdir

How To Access Encrypted Files on Another Computer

Install Dropbox and CryFS on the second computer. Wait for Dropbox to finish syncing. Then mount the encrypted directory using the following command. You will need to enter your CryFS password.

cryfs ~/Dropbox/encrypted/ ~/mountdir

Now you can access files in ~/mountdir.

That’s it! I hope this tutorial helped you encrypt Dropbox on Ubuntu using Cryptomator and CryFS. As always, if you found this post useful, then subscribe to our free newsletter.

Rate this tutorial
[Total: 3 Average: 4]