cfs is available via pkgsrc, so it's installation is very easily done with:
/usr/pkgsrc/security/cfs/
make && make install && make clean
After installation finished you have to create, configure and export a working directory:
mkdir /null
chmod 0 /null
echo /null localhost >> /etc/exports
Now [re]start mountd and cfsd
/etc/rc.d/mountd [re]start && /usr/pkg/sbin/cfsd
configure a cfs mount point and mount it:
mkdir /crypt
mount -o intr,-2,-w=4096,-r=4096 127.0.0.1:/null /crypt
finally mountd and cfsd should be started via /etc/rc.conf resp.
/etc/rc.local, also you can add the mount command to the latter.
Now it is time to create the encrypted directory, the -b option specifies "Blowfish" algorithm.
Please refer to man-page for other algorithms, such as 3DES or MacGuffin.
cfs_mkdir -b /encrypted
cfs_mkdir now asks for an at least 16 character long passphrase which should be of course very
strong, e.g. use numbers, capitalization and special characters.
cfs is now configured and ready for use. To mount your encrypted directory supply
cfs_attach /encrypted usable_cfsdir
and enter your pasphrase. It is now attached as /encrypted/usable_cfs and can be used like a regular directory,
e.g. you can copy files into it.
For example, if you copy /etc/motd to /encrypted/usable_cfs with
cp /etc/motd /encrypted/usable_cfs/
you can access /encrypted/usable_cfs/motd as usual, because this is the decrypted interface to the "real" encrypted
file, now residing in /crypt/
To detach the encrypted directory use
cfs_detach usable_cfsdir
Now you cannot access /encrypted/usable_cfs/ anymore