Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Encfs work?

Tags:

encryption

I cannot understand the idea behind Encfs. Even ready example, offered by my Ubuntu, does not work for me:

encfs ~/crypt ~/.crypt

There is an error:

unable to locate a mount point

Should I initialize the files somehow? What is wrong?

like image 698
Léo Léopold Hertz 준영 Avatar asked Oct 29 '25 23:10

Léo Léopold Hertz 준영


1 Answers

As I use encfs since 2009 and until now every day, I will make a quick how to :

What you need for make it work ?

fuse and encfs only, they can be found directly in your package management

Debian : apt-get install encfs
Fedora : yum install encfs
Gentoo : emerge encfs

...

(select only encfs will install dependencies automatically)

How do I create a crypted directory ?

If you want to use encfs with your user (no root), you must add fuse on the group of this one first. Open a terminal and log in root :

adduser youruser fuse

replace youruser by your.

Once add, kill and restart X or just reboot your computer.

Now open a terminal (in user $) :

groups

If you see fuse, then you can create the directory now by this command :

encfs /home/youruser/.crypt/ /home/youruser/crypt

.crypt and crypt directory must not exist, if they exist, delete them or choice another path

The first time, it will display as follow :

The directory "/home/youruser/.crypt/" does not exist. Should it be created? (y,n) y
The directory "/home/youruser/crypt" does not exist. Should it be created? (y,n) y
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. ?> p
New Encfs Password:
Verify Encfs Password:

As showed, answer -> first y | second y | third p

Once created, the directory crypt is mounted (by default), add files inside crypt directory. For make them unreadable :

fusermount -u /home/youruser/crypt

This will unmount the directory crypt, all the file inside "disappear" and can be found encrypted on the directory .crypt :

ls /home/youruser/.crypt/

Will display something like (3 files on this example) :

0WoRsjyzZHI,Un-198TRY-dU  91rj264Z09Jcz7XZ4sbDeYfd  KpJTDI2TVUEFHTkksqxPT9xu

For get back your crypted file readable, do :

encfs /home/youruser/.crypt /home/youruser/crypt 

Will output a prompt requiring your password

How do I backup the crypted file, and open them to another computer / server

Be aware, except your encrypted file, you absolutely need to backup the file encfs6.xml which contain your encoded password and his salt generation.

http://en.wikipedia.org/wiki/Salt_%28cryptography%29

this file can be found :

/home/youruser/.crypt/.encfs6.xml

Best way to backup your crypted data in a proper way :

tar cvzf CryptedBackup.tar.gz /home/youruser/.crypt/

With the backup, on your other computer/server just unpack it to the /home/user/ and create the mount point (mkdir /home/user/crypt) and it will work.

Careful, if you lost your password, or if your encfs6.xml is missing, is no way to get back your encrypted

like image 151
Anyone_ph Avatar answered Nov 02 '25 06:11

Anyone_ph