Skip to content

Instantly share code, notes, and snippets.

@rmasters
Created May 2, 2011 17:03
Show Gist options
  • Save rmasters/951925 to your computer and use it in GitHub Desktop.
Save rmasters/951925 to your computer and use it in GitHub Desktop.
Ubuntu recovery with encrypted home directory
For when Ubuntu crashes out and you need to backup from a live CD.
Source: http://ubuntuforums.org/showthread.php?t=1534704
1. Locate the ubuntu filesystem in /media, it'll have a name like /media/8805834782... - it's UUID.
2. If the dir isn't encrypted you'll be able to browse /media/UUID/home/user/*, otherwise it'll have two files about ecryptfs - follow to the next step.
3. If the dir is encrypted you'll need to mount it - for this you will need the passphrase and filename encryption key signature:
4. First add the passphrase (see 4a if you don't know it):
$ sudo ecryptfs-add-passphrase --fnek
Passphrase: <enter passphrase>
Inserted auth tok with sig [hash] into the user session keyring
Inserted auth tok with sig [hash] into the user session keyring
Make sure to keep the second hash!
4a. To recover a passphrase run:
$ sudo ecryptfs-unwrap-passphrase /media/UUID/home/.ecryptfs/user/wrapped-passphrase
5. Mount the directory:
Use a username not on the live cd's home:
$ sudo mkdir -p /home/username
$ sudo mount -t ecryptfs /media/UUID/home/username /home/username/
Passphrase: <enter passphrase>
Select cipher: (list) <use aes, should be default>
Select key bytes: (list) <16, default>
Enable plaintext passthrough: n
Enable filename encryption: y
Enter Filename Encryption Key (FNEK) signature: <enter signature from before>
Attempting to mount...
Would you like to proceed with the mount (yes/no): yes
Would you like to append signature [...] to [/root/.encryptfs...]: no
$ sudo ls /home/username
6. Cake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment