How to use encfs on Linux to encrypt and decrypt data and sync with Dropbox

You can encrypt data locally on your computer using encfs. Although our ultimate goal is to move the data encrypted to dropbox and to be able to read it on our Android device.

Install Dropbox on your Linux computer before you proceed with the instructions below.

Open a terminal window in Linux.

Create the encrypted and decrypted folder on your computer.
$ encfs ~/Dropbox/dropcrypt ~/dropplain <enter>

Enter a good password. Note that you only need to ensure that you do not copy files in dropcrypt.

Copy your normal files into dropplain.
$ cp aaa dropplain <enter>

And see the transformation in dropcrypt like this.
user@localhost:~$ ls -al Dropbox/dropcrypt <enter>

total 40
drwx------  2 user group  4096 Jan 25 12:31 .
drwx------ 37 user group 12288 Jan 25 12:31 ..
-rw-r--r--  1 user group    62 Jan 25 12:31 df45TteNATg0ua2dp4dXDvSC
-rw-r--r--  1 user group  1078 Jan 25 12:27 .encfs6.xml

Fascinating? Yes. Our file aaa got converted into df45TteNATg0ua2dp4dXDvSC. Who will tell that the actual name was “aaa”. Important to also note that if you delete the .encfs6.xml file, you will not be able to decrypt at all. Important, if you were to use boxcryptor, the file name will still appear as aaa but the contents will be encrypted.

If you list the contents of the encrypted file, it is all gibberish.

This trick is not just for the local computer, but you can synchronize the file upto dropbox and know for sure that it is encrypted.

Unmount the plain text folder
Finally, unmount your dropplain folder, so that it does not show any decrypted data.
$ fusermount -u dropplain <enter>

Now see the contents of dropplain folder on your computer, you will find nothing in it.
$ ls -la dropplain <enter>

Verify it is empty.
Now see the contents of the dropcrypt folder on your computer. You will find all the gibberish in it.

user@localhost:~$ ls -al Dropbox/dropcrypt <enter>
total 40

drwx------  2 user group  4096 Jan 25 12:31 .
drwx------ 37 user group 12288 Jan 25 12:31 ..
-rw-r--r--  1 user group    62 Jan 25 12:31 df45TteNATg0ua2dp4dXDvSC
-rw-r--r--  1 user group  1078 Jan 25 12:27 .encfs6.xml

Regular usage
Anytime you want to work with your data in the encrypted folder on your computer, do this and enter your password:
$ encfs ~/Dropbox/dropcrypt ~/dropplain <enter>

And when you are done, do this:
$ fusermount -u dropplain <enter>

You can use any file manager to copy unencrypted files or even folders to the dropplain folder. It gets automatically encrypted and put into dropcrypt folder.

That’s all, now if you need to push encrypted data to cloud storage, just sync the dropcrypt folder to dropbox. As you put data or files into the dropplain folder, they will be encrypted into the dropcrypt folder and synchronized automatically with Dropbox.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s