How to encrypt existing files with encfs

2

1

Encfs documentation explains how to create two new folders (raw storage and mounted folder).

Once a new file is created in the mounted folder, it is automatically encrypted and saved to the raw storage.

I want to encrypt existing files in a directory without copying them twice.

Is there a way to do so?

Alex

Posted 2012-05-10T08:58:32.237

Reputation: 135

copying twice? you create the encrypted folder, copy the files once .. and rename the encrypted folder... ? – akira – 2012-05-10T09:06:00.343

Answers

3

Let's compare encfs with a simple file encryption

Encrypt a file using openssl

openssl enc -aes-256-cbc -salt -in file.txt -out file.enc  
rm file.txt

What happens?

  • the contents of file.txt get read exactly once.
  • the contents of file.enc get written exactly once.
  • a directory entry for file.txt is removed

(you probably want to securely wipe file.txt but I'll skip that)

Encrypt a file using encfs

 cp /normal/file.txt /encrypted/file.txt
 rm /normal/file.txt

What happens?

  • the contents of /normal/file.txt get read exactly once.
  • the contents of /encrypted/file.txt get written exactly once.
  • a directory entry for /normal/file.txt is removed

Conclusion

There's no scope for reducing the amount of IO

RedGrittyBrick

Posted 2012-05-10T08:58:32.237

Reputation: 70 632

cp && rm => mv ? – akira – 2012-05-10T11:11:14.790