How To Encrypt Cloud Storage files & Folders In Linux

data encryption file encryption encryption key cloud file encryption linux

Most of us use cloud storage like, Dropbox, Gdrive, Copy etc. to be able to use our synced files anytime, anywhere and from our any devices. But no one feels safe putting up their sensitive data over there. As recent hacks shows that how safe our data is. In 2014 many celebrities photos were hacked from cloud storages and posted on social networking sites. So why not encrypt data before upload it on cloud storage to increase security.

What Is Encryption?

When you google ‘What is Encryption ?’, you get this –

“Data Encryption is the most effective way to achieve data security. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it. Unencrypted data is called plain text; encrypted data is referred to as cipher text.”

what is data encryption?

As it’s very clear from this webopedian definition that encrypted mean to convert files from accessible format to an inaccessible format so that no one can use them. When you encrypt files then you set a password this way only those can access files who have that secret password.

Buy this book to learn more about data encryption

Why Encrypt Cloud Storage Files or Folders?

encrypt cloud storage files in linux

The main purpose of this article is not only to increase security for hackers but also for your friends, relatives, and team members. If you have multiple computers and have cloud storage client installed on them, then surely any user can see at your photos, files that you have been uploading from other devices. So once you encrypt your files now they can not be accessible from anyother devices until you provide them your secret password.

For cloud storages like Dropbox, copy, Gdrive, Onedrive (Skydrive) and many more, they already encrypt the files and make then unaccessible. But as recent hacks show how secure our files are even after that encryption. Well, if you upload your encrypted sensitive files then it is an additional security step. In 2014, many celebrities cloud storage account were hacked (most of them were female) and their sensitive (even many nude) photos were posted on social networking sites, for reference read this Wikipedia article.

How To Encrypt Cloud Storage Files or Folders In Ubuntu/Linux Mint?

To encrypt our sensitive data we’ll use free encryption software/program named ‘encfs’. Before we install and configure encfs let’s see how it works, don’t worry that’s very simple.

encfs unlike any other encryption programs, create two folders one is the folder that will have your decrypted (don’t worry it is still inaccessible) and the second folder will have encrypted files.

Here our second folder containing encrypted files or folder will be our cloud storage folder, for example, Dropbox folder, grive folder (unofficial client for Google drive), copy folder etc.

So that’s all you needed to know, now let’s get started –

Open terminal (ctrl + alt + T) and install encfs –

$ sudo apt-get install encfs


encfs command automatically creates a folder but it did not for me and gave the error, so create folders manually to avoid any error.

Create two folders one inside your cloud storage folder in my case it’s ‘encrypted’ and second in my case ‘Private’ anywhere but for ease of access create inside your home folder.

one for encrypted file version and second for decrypted files version.

encfs ~/Dropbox/encrypted ~/Private

You can change the above command according to you. For example, if you are using Copy, Grive or anyother service’s client to sync your files then put that folder name instead of ‘Dropbox’. And that will create a folder named ‘encrypted’ inside your storage folder.

~/Private is the second folder in your home folder. This is the place where you will be keeping your files and those files will automatically be encrypted and synced with /Dropbox/encrypted folder. And Dropbox or any other service will sync those encrypted files!!!

You will be asked to enter ‘p’ for pre-configured paranoia mode, ‘x’ for expert configuration mode or press enter without ‘p’ or ‘x’ for standard mode.
‘p’ should work properly, so type ‘p’.

cloud data encryption in linux

You will be asked for the password or encryption key that will be used to access encrypted files on your system. Don’t forget this password otherwise You will not be able to access your files.

encryption key for cloud data in linux

So let’s encrypt our first file and upload it on Dropbox –


  1. Once you restart your computer you will need to rerun the encfs command to remount the private folder. It is a security feature if someone else uses your computer, then he will see Private folder empty. 
encfs ~/Dropbox/encrypted-files ~/Private
    2.    Don’t delete .encfs.xml file inside your encrypted-file folder. If you delete it then you will lose access to your encrypted files.

encfs data encryption .encfs.xml

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This website uses cookies to improve your experience. We'll assume you're ok with this. Thank you! Accept Read More