Encfs is an open-source software that is widely used to create encrypted filesystem. It is particularly useful for encrypting files that you want to store in the cloud, such as Dropbox or Google Drive. Using encfs in Linux and Windows is pretty straightforward as there are installers for both platforms. However, for Mac OS X, installing encfs is not as easy as it should be. Here is how you can install and use encfs in Mac OS X.
Installing encfs in Mac OS X
There are a number of ways to install encfs in Mac OS X. In this tutorial, we will show you the homebrew and OSXfuse installation method. It will require the use of terminal, so be prepared to get your hands dirty.
Homebrew is a useful package manager for Mac OS X. It allows you to install plenty of applications with a single command.
1. Open Terminal in Mac OS X. If you are not aware of where it is located, you can find it at “Applications -> Utilities -> Terminal”. Type the command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This will install Homebrew in your system. If you have already installed Homebrew, you can ignore this step.
To install encfs (in El Capitan), simply run the command in the terminal:
brew install homebrew/fuse/encfs
Once the installation is completed, you will have encfs running in your system.
Using encfs in Mac OS X
Still in the terminal, you can create an encrypted filesystem in Dropbox using this command:
encfs ~/Dropbox/Private ~/Private
[mte_content_ads]Go through the setup process. You will be prompted to enter a master password. Make sure you use a strong password and remember it. Once completed, you should see a “Private” folder in your Home directory. Any file you place in this folder will be encrypted and stored in the “Dropbox -> Private” folder.
Automount encrypted directory on startup
It is very troublesome if you have to mount the encrypted directory everytime you login. Use the steps below to automount the encrypted directory when you login.
1. Open “Keychain Access”. We will be adding your encfs master password to Keychain so the script can automount the encrypted directory without prompting you for password. Add a new entry. Enter “encfs” for both the “Item name” and “Account Name” field. Once you have added the password, you can close Keychain Access.
2. Open a text editor and copy the following text into it.
#!/bin/bash ENCFS="/usr/local/bin/encfs" ENCDIR="$HOME/Dropbox/Private" DECDIR="$HOME/Private" security find-generic-password -ga encfs 2>&1 >/dev/null | cut -d'"' -f2 | "$ENCFS" -S "$ENCDIR" "$DECDIR"
Save the file as “encfslogin.sh” in your User directory.
Make the script executable:
chmod a+x encfslogin.sh
3. Next, open AppleScript editor and paste the line:
do shell script "$HOME/encfslogin.sh"
and save it as an application in your User directory.
4. Lastly, go to “System Preferences -> Users & Groups”, click on your User account and select “Login items”. Add the encfslogin application to the startup list.
Log out and login again. Your encrypted directory should be auto-mounted now.
Image credit: security concept with a lock by BigStockPhoto