For recent versions of Ubuntu, if you set your account up to use an encrypted home directory during the initial setup, it will have set up a directory called /home/.ecryptfs/[your_user_name]. This directory will have two subdirectories, .Private and .ecryptfs. The encrypted files that get mounted to your home directory will be kept in .Private; .ecryptfs has the wrapped passphrase and other configuration files used by ecryptfs.
When you login to your computer, your encrypted files in /home/.ecryptfs/[your_user_name]/.Private get mounted to /home/[your_user_name] automatically, using your login password to unwrap your ecryptfs password and use that to mount the encrypted files correctly, so you can access your home directory securely.
Since your hard drive crashed. ecryptfs has not been working correctly. This could be due to corruption of some of the encrypted data in /home/.ecryptfs/[your_user_name], or more likely, corruption to some of the system files that run linux, so that the ecryptfs system (or some related system) no longer runs correctly.
As a quick aside - a couple things to note here: first, things like this are reasons why its important to back up your data. Second, if you're using encrypted home directories, it's also a good idea to keep a copy of the unwrapped passphrase used to encrypt your home directory in a safe, secure place, not on that computer (you can see what that passphrase is by running
...and entering your login password when prompted). This unwrapped passphrase can be of help if you need to recover the encrypted data later.
If you need to recover your encrypted data from your hard disk--you can do so with the
command. For example, if you run
...you will be prompted for your login password (or for the unwrapped passphrase if no wrapped-passphrase file is available). Your encrypted home directory will then be mounted at /tmp/ecryptfs.XXXXXXXX (type df to see the exact directory name). You can then access this directory to get your home directory data, and copy it to another disk.
Note that if you copy the directory /home/.ecryptfs/[your_user_name] to another computer, you can still run ecryptfs-recover-private as above on the new computer and recover the data there.
So in a case where a hard disk is damaged and an encrypted home directory can no longer be accessed, you might typically want to:
- Boot your system from a live CD
- Mount the partition with /home
- Copy the /home/.ecryptfs/[your_user_name] directory to the safe hard
disk you want to save the data to. You could use rsync, or cp -a if
the safe hard disk is also mounted.
- Use ecryptfs-recover-private to recover the data from the copied
directory on the safe hard disk.