Dec 172007

Encrypt folders in Mac OSX with

OSX already include the File Vault functionality that allows you to encrypt your whole Home Folder.
Thou the storage overhead is so small, the time to encrypt it the first time is very very long.
if you have Videos, and big files, it takes even longer.RA Grani

What if I don’t want to encrypt my big folders like Movies, Music, Pictures, Pdfs?

I only want to encrypt my Documents folder.
Be aware that VMWARE stored the virtual machine files under this folder, you should move it to outside Documents.


Be careful with this tutorial,
Write down your password somewhere and BACKUP your data before going further these steps.

if you forget your password, say good bye to your data.


TOOLS required:

# update your ports to get the latest encfs that runs ok on OSX10.5
$ sudo port selfupdate

# install encfs
$ sudo port install encfs

or Download macfuse and encfs from google:


Lets move The Documents folder contents to another folder:

$ cd
$ mkdir temp_documents
$ mv Documents/* temp_documents/

Create the directory to hold the encrypted files, it can be any name.

Run this only one time. The first time to setup the folder…

$ mkdir .documents

Setup the encryption

$ encfs ~/.documents/ ~/Documents/

you will see this:

now, after you pass this step, the file system will be mounted as well .

encfs uses FuseFS, so it behaves just like a mount point

to unmount it you do

$ unmount ~/Documents

to mount it again issue this command:

$ encfs ~/.documents/ ~/Documents/
# or this way, which will look with better names and a folder icon on Desktop:
$ encfs ~/.documents/ ~/Documents/ -- -o fsname=Documents -o volname=Documents -o local

to check mounted filesystems

$ mount

you should be able to see:

encfs@fuse2 on /Users/fred/Documents (fusefs, nodev, nosuid, synchronous, mounted by fred)

or this if you used the longer command.

Documents on /Users/fred/Documents (fusefs, local, nodev, nosuid, synchronous, mounted by fred)

Now, with the encrypted folder “mounted”, mv the data from that temp folder to the new encrypted folder:

WARNING: be carefull here

$ cp temp_documents/* Documents/
$ rm -rf temp_documents/

that’s it folks.

Final overview:

# to create the encrypted folder:
$ encfs ~/.documents/ ~/Documents/
#to Mount it (enable)
$ encfs ~/.documents/ ~/Documents/
$ encfs ~/.documents/ ~/Documents/ -- -o fsname=Documents -o volname=Documents -o local
#to Umount it (disable)
$ umount ~/Documents

don’t change anything inside .documents
remember the dot in the front means the folder is invisible
you won’t see it in Finder.

This also should work for Linux.

Switch to our mobile site