.ecryptfs recovery

I’m experimenting with ecryptfs, a tool that uses transparant file-level encryption.

What I was wondering about is: what happens when you delete the “$HOME/.ecryptfs” directory? As it happens, the recovery is easy (as long as you have the mount passphrase safely recorded somewhere):

  1. Optional: move $HOME/.ecryptfs dir out of the way
  2. mv $HOME/.Private $HOME/.OldPrivate
  3. ecryptfs-setup-private
  4. Enter your login passphrase (to unlock the keyring)
  5. Enter your old mount passphrase
  6. Move all files from $HOME/.OldPrivate into $HOME/.Private
  7. ecryptfs-mount-private

And there are your files again!