Skip to main content

Encrypted Filesystem - Virtual filesystem with folder, file and content encryption

Linux is wonderful when it comes to security aspects and data protection. My challenge was

  • Laptop having personal details in files and folders
  • Have to encrypt these data so that if laptop is lost, the data shouldn't be replicated
  • Have to use "git" to backup the data normally and version it

Solution for Linux

Design your folder/directory structure


  • Ensure that all your personal files are well structured
  • Ensure all files are put into a single directory/folder hierarchy  (eg "/home/myuser/personal/")

Setting up encfs

In Ubuntu, run 

sudo apt-get install encfs

Encrypted Directory and Mount location

encDir="/home/diaryfolio/Docs/encr" # Where encrypted files are stored
mntDir="/home/diaryfolio/Docs/mydocs" # Mount created

# Create encrypted directory and mount directory
encfs $encDir $mntDir

# Press Enter which uses default encryption
# Provide a strong password and REMEMBER it in future

# Copy content/files/directories to $mntDir once you mount it

# Unmount $mntDir afterwards
fusermount -u $mntDir

# You can now only see $encDir  and encrypted files

# To remount and view files in plain format. It will ask you for your password
encfs $encDir $mntDir