Encrypt folders in Mac OSX with encfs

Posted on December 17, 2007

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.

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.

WARNING:

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.

THERE IS NO WAY TO GET YOUR DATA BACK!!!

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


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:



fred@Macintosh ~ $ encfs ~/.documents/ ~/Documents/
Creating new encrypted volume.
Please choose from one of the following options:
 enter "x" for expert configuration mode,
 enter "p" for pre-configured paranoia mode,
 anything else, or an empty line will select standard mode.

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/ or $ encfs ~/.documents/ ~/Documents/ -- -o fsname=Documents -o volname=Documents -o local

to Umount it (disable) $ umount ~/Documents

never remove .documents folder, or touch it. 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.

Bash Profile in OSX (.bash_profile)

Posted on December 03, 2007
The console terminal in OSX ain't too good looking... so, here is the .bash_profile for my OSX.
It includes dir colors and bash history auto completion ( when you start typing the word and press arrow up to complete with older commands, like Linux page_up style) .bash_profile save it as ~/.bash_profile (add the dot in front)

My /etc/DIR_COLORS file :

DIR_COLORS