How can I completely remove ecryptfs from my system and delete .Private?

The removal procedure is documented in the ecryptfs-setup-private(1) utility, with the --undo option:

$ ecryptfs-setup-private --undo

In the event that you want to remove your eCryptfs Private Directory setup,
you will need to very carefully perform the following actions manually:

 1. Obtain your Private directory mountpoint
   $ PRIVATE=`cat ~/.ecryptfs/Private.mnt 2>/dev/null || echo $HOME/Private`
 2. Ensure that you have moved all relevant data out of your $PRIVATE directory
 3. Unmount your encrypted private directory
   $ ecryptfs-umount-private
 4. Make your Private directory writable again
   $ chmod 700 $PRIVATE
 5. Remove $PRIVATE, ~/.Private, ~/.ecryptfs
    Note: THIS IS VERY PERMANENT, BE VERY CAREFUL
   $ rm -rf $PRIVATE ~/.Private ~/.ecryptfs
 6. Uninstall the utilities (this is specific to your Linux distribution)
   $ sudo apt-get remove ecryptfs-utils libecryptfs0

Full disclosure: I am one of the authors and maintainers of eCryptfs.


Actually ecryptfs tells you very specifically what to do when you run ecryptfs-setup-private --undo, just follow its instructions.

Obtain your Private directory mountpoint

$ PRIVATE=`cat ~/.ecryptfs/Private.mnt 2>/dev/null || echo $HOME/Private`

This command populates the $PRIVATE variable with the path to your private directory. Either the path is stored in ~/.ecryptfs/Private.mnt file (where ~ is your home directory) or if the file doesn't exist, it will fall back to ~/Private path. You can then run echo $PRIVATE command to verify content of the PRIVATE variable. When you see $PRIVATE in the following commands, it will be substituted with the contents of the variable, ~/Private in your case.

Ensure that you have moved all relevant data out of your $PRIVATE directory

This is important.

Unmount your encrypted private directory

$ ecryptfs-umount-private

eCryptFS is kind of a filesystem which is mounted in user space (Wikipedia explains what's mounting about. That's also the reason why the Private folder cannot be removed so easily. Think of it as kind of proxy which transparently encrypts and decrypts your files. This command un-mounts the folder which effectively disables the encryption.

Make your Private directory writable again

$ chmod 700 $PRIVATE

chmod sets file permissions. In this case, you say: "make file/directory stored in $PRIVATE readable, writable and executable for me (700)" – you can't otherwise delete the directory since you don't have write access.

Remove $PRIVATE, ~/.Private, ~/.ecryptfs

Note: THIS IS VERY PERMANENT, BE VERY CAREFUL

$ rm -rf $PRIVATE ~/.Private ~/.ecryptfs

This does exactly what it says. rm command means ReMove, -r means recursive (to recursively remove directories), and f means Force ("stop nagging me, just delete it"). This will remove all these three directories: $PRIVATE, ~/.Private, ~/.ecryptfs

If you want to, you can remove these directories manually from Nautilus (just check "View > Show hidden files" to see .Private and .ecryptfs directories in your home dir).

Uninstall the utilities (this is specific to your Linux distribution)

$ sudo apt-get remove ecryptfs-utils libecryptfs0

This will remove ecryptfs-utils and libecryptfs0. You can do this from Synaptic instead or just ignore it if you want to keep eCryptFS around (e.g. for other users).

If you follow these instructions, there's no risk of wrecking your system or losing your files – unless, of course, you don't backup your files from ~/Private directory.


I followed the instructions given in https://help.ubuntu.com/community/EncryptedPrivateDirectory#Using%20in%20conjunction%20with%20Auto-login in the section "How to Remove an Encrypted Private Directory Setup".

Notes:

  • You must be logged in the correct user session, I mean the one you don`t want to be encrypted.
  • BACKUP all the data in your Private folder (/home/your-user-name/Private normally.
  • Delete ecryptfs (step 5) is optional, with the previous steps it`s ok.

If you don`t have access to the data in your Private folder, or the file names are encrypted, then follow this steps:

Note: This procedure is an alternative I found by myself (with a friend help) because all I read in forums doesn`t work for me.

  1. $ sudo ecryptfs-recover-private
  2. $ [sudo] password for "user-name"
  3. $ INFO: Searching for encrypted private directories (this might take a while)...
  4. INFO: Found [/home/.ecryptfs/"user-name"/.Private].
  5. Try to recover this directory? [Y/n]: Y
  6. INFO: Found your wrapped-passphrase...
  7. Do you know your LOGIN passphrase? [Y/n]: Y
  8. INFO: Enter your LOGIN passphrase... Passphrase:*LOGIN PASSPHRASE of "user-name"
  9. Inserted auth tok with sig [xxxxxxxxxxxxxxx] into the user sesiong keyring
  10. INFO: Success! Private data mounted read-only at [/tmp/ecryptfs.yyyyyyyy].
  11. $ sudo nautilus /tmp/ecryptfs.yyyyyyyy/

The last command will open the folder /tmp/ecryptfs.yyyyyyyy were you can acess your decrypted data in order to make the backup. Then you close the folder and close the terminal.