Easily encrypt folders

WARNING: This tutorial has been superseded by a future tutorial, using ecryptfs (due to security concerns with encfs, plus better performance), found here.

Encfs is a program that can be used to encrypt folders, unlike other encryption methods this doesn’t require a file of a fixed size, so you can use the decrypted folder in the same way as a regular folder without worrying about space.

This tutorial will explain how you can use a plugin as a convenient way to use this tool.

Pre-installation

In order to use this plugin you will of course need to install the encfs program first, the easiest way to do that (on Ubuntu) is to try clicking this link:
apt:encfs

or copy this into a terminal:
sudo apt install encfs -y

In addition to this we will be using gnome-encfs, a small program that allows you to use the gnome-keyring to store encryption passwords. This program by Oben Sonne can be found here; after downloading it, extract the gnome-encfs file to your home folder.

Then to install it run:
sudo install gnome-encfs /usr/local/bin

Installation

To install the actual plugin simply open a terminal and copy & paste these commands:

sudo apt install python-nautilus
mkdir -p ~/.local/share/nautilus-python/extensions/
cd ~/.local/share/nautilus-python/extensions/
wget https://sambull.org/downloads/encrypt-nautilus.py
chmod a+x encrypt-nautilus.py

If you want to try this out immediately, press Alt+F2 and enter “nautilus -q”, then repeat and enter “nautilus”, otherwise it will be available next time you login.

Usage

This new version has a greatly simplified and streamlined interface.

Simply right-click a folder you want to encrypt and click “Encrypt folder”, confirm when prompted and the contents of the folder will be immediately encrypted.

To view the decrypted contents, simply open the folder in Nautilus and it will be automatically mounted. If you want to manually unmount the folder, simply right-click and click “Unmount encrypted folder”.

Notes

If you want to backup your encrypted files, they are stored in a hidden folder called “.[name]-enc”.

Folders are encrypted with a randomly generated password, which is stored in your keyring. Make sure you backup your keyring, or you risk losing all your encrypted files.

If you want to move/rename a folder, you will need to move/rename both the folder, and it’s encrypted counterpart. You will then also need to update the keyring. I hope to remove the last step in another update in the future.

Upgrading

If you’ve used the extension before the latest update, you will need to change your encrypted folders to work with this new extension. Simply rename each of your encrypted folders to “.[name]-enc” and create an empty folder called “[name]”. If you then open the latter folder, you should be prompted for a password, copy this from the password stored in you keyring and you should be setup (you can then delete the old password from the keyring).

Extension

I’ve written a follow-up post to this one that explains how this can be used to encrypt Firefox data seamlessly. You can read it here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Website Protected by Spam Master