Setting Up eCryptFS in Linux

By: Zhiqiang Ma In: Linux

How to set up eCryptFS in Linux will be introduced in this post. We can store encrypted files in one eCryptFS directory. The content can be seen only after it is mounted as eCryptFS file system. Otherwise, the users can only see garbled characters in the files.

Install eCryptFS tools

# yum install ecryptfs-utils gettext

Add ecryptfs module to Linux Kernel

# modprobe ecryptfs

Add user to ecrypfs group

If we want to add user zma and eric to ecryptfs group:

# vim /etc/group

Find:

ecryptfs:x:496:

Then change it to:

ecryptfs:x:496:zma,eric

Mount ecryptfs

If we store encrypted file in /home/private directory:

# mount -t ecryptfs /home/private /home/private

Then you can read/write from/to files under /home/private as a normal directory.

Umount ecryptfs

# umount /home/private

Then try to open a file under /home/private. Haha, nothing can be found!

When you want to read your find, mount this directory again and your files will be back :)

Author: Zhiqiang Ma Posted on: May 11, 2010 Views: 411
Tags: , , , ,
Like this post? Subscribe full-text feeds from all Fclose.com blogs:
Add your comments, share your thoughts

Be nice. Keep it clean. Stay on topic. No spam.