How to Recover an Encrypted Home Directory on Ubuntu

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 1

Access an encrypted home directory when you’re not logged in – say, from a live CD – and all you’ll see is a README file. You’ll need a terminal command to recover your encrypted files.

You should also back up your mount passphrase ahead of time – you may need this in the future. While eCryptfs normally decrypts your files with your login passphrase, the mount passphrase may be necessary if eCryptfs’s files become lost.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 2

Back Up Encryption Passphrase

If you use an encrypted Ubuntu home directory, you should keep a backup copy of your mount passphrase. You’ll see a dialog prompting you to do so after encrypting your home directory. Write down this passphrase and keep it somewhere safe – you may need it to recover your files in the future.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 3

If you want to acquire this mount passphrase at a later date, just run the ecryptfs-unwrap-passphrase command while logged in.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 4

You can still recover your encrypted files without this mount passphrase, assuming the ecryptfs wrapped passphrase is still available on your hard drive. However, if you lose this data or it becomes corrupted, you’ll need the mount passphrase to recover your files.

Recovering From a Live CD

You can recover your files by booting from a Ubuntu live CD or USB drive. If you still have the disc or USB drive you installed Ubuntu from, you can use that. Otherwise, you can download an ISO from Ubuntu’s website and place it on a CD, DVD, or USB drive.

Log in to the live Ubuntu environment and ensure the partition containing your encrypted home directory is mounted. You can easily mount it by clicking It in the file manager – you’ll see an eject (unmount) icon, indicating the partition is mounted.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 5

Next, fire up a terminal and run the following command to search your mounted file systems for encrypted private directories

sudo ecryptfs-recover-private

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 6

The command will offer to recover an encrypted directory if it locates one.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 7

Assuming the command found a wrapped passphrase file on your system, it will prompt you for your login passphrase. If it doesn’t find this file, you’ll need the mount passphrase from the ecryptfs-unwrap-passphrase command – hopefully you have a copy of this. If you don’t, you can’t recover your files.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 8

The command will mount the encrypted directory in your /tmp directory.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 9

You can access this directory to view the decrypted versions of your files. However, you may not have read access to this directory as the live CD user.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 10

To access the directory with a graphical file browser, run Nautilus as root. Press Alt+F2, type gksu nautilus, and press Enter.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 11

You’ll be able to access your files from the Nautilus window running as root. From here, you can easily copy the files to an external hard drive or another location.

how-to-recover-an-encrypted-home-directory-on-ubuntu photo 12

More stories

The Best How-To Geek Articles for May 2012

This past month we covered topics such as alternative search engines that respect your privacy, tips and tweaks for getting the most out of Chrome, using camera Raw tools to develop digital photographs, and more. Join us as we look back at the most popular articles for May.

Here’s How to Download Windows 8 Release Preview Right Now

Want to get the latest version of Windows 8 right now? This one is called the Release Preview, and it’s available for download right now. There’s a lot of little bugs resolved, the multi-monitor support has improved, and you should download it now.

Disable Add-Ons to Speed Up Browsing in Internet Explorer 9

We’ve shown you how to enhance Internet Explorer with add-ons, similar to Firefox and Chrome. However, too many add-ons can slow down Internet Explorer and even cause it to crash. However, you can easily disable some or all add-ons.

Enhance Internet Explorer 9 with Add-Ons

If you’re one of those who still use that “other” browser (Internet Explorer or IE), you’ll be glad to know that there are ways to extend the functionality of IE just like you can in Firefox or Chrome.