Recently my old desktop system crashed and I brought a new Ubuntu Laptop from Dell. To access my data from old hdd; I’ve attached my desktop harddisk using an external USB case. Now my old data is stored using external USB hard disk. How do I recover data from encrypted ~/.private home directory using an Ubuntu Live CD and copy it to existing laptop drive using known passphrase?

You can easily mount Ubuntu Encrypted Private or Encrypted Home directories from an Ubuntu LiveCD.


Step # 1: Boot From LiveCD

Use Ubuntu Live CD to boot system. Attach external USB hard disk to the system. If automouted just remove it.

Step # 2: Chroot To Old Hard Disk

Open terminal and type the following command to find USB device name:
$ sudo -s
# fdisk -l

Mount USB device at /media/chroot, enter:
# mkdir -p /media/chroot
# mount /dev/sdb1 /media/chroot

Replace /dev/sdb1 with actual USB device name.

Mount /proc file system inside /media/chroot

Type the following commands:
# D=/media/chroot
# mount -o bind /dev $D/dev
# mount -o bind /sys $D/sys
# mount -o bind /dev/shm $D/dev/shm
# mount -o bind /proc $D/proc

Optional give access to laptop hard disk inside chroot:
# mkdir $D/data
# mkdir /data-recovery
# mount --rbind /data-recovery $D/data

Chroot to $D

Type the following command to login into your old hard disk, enter:
# chroot $D
# su - username
# su - vivek

Replace vivek username with your actual username.

Mount Encrypted Home Directory

Type the following command:
$ ecryptfs-mount-private
The above will interactively prompt for the user’s login password. Once entered you can access data at /home/vivek:
$ df | grep vivek
$ cd /home/vivek
$ ls

How Do I Copy Data To Laptop?

Simply use cp or rsync command. Make sure laptop hard disk is also mounted from LiveCD:
$ cp -avr /home/vivek/data.dir/ /data
Make sure /data accessible inside chroot using the mount command (see above). When you exit from chroot jail, you should see your data at the following location:
# ls /data-recovery

How Do I Copy Data To Another System Over LAN?

Use rsync / scp / sftp command as follows:
$ rsync -av /home/vivek/data/dir1 user@server1:/data/to/dest
$ scp /path/to/file user@


  • EncryptedPrivateDirectory topic from the official Ubuntu wiki.
  • man pages – mount, df, fdisk, su, sudo, and grep commands.

πŸ₯Ί Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🀠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

13 comments… add one
  • Lazza Aug 19, 2012 @ 20:55

    Use the link I provided to access your data, after that, you should back it up in clear form and maybe create a new user with an encrypted home setup, then copy all the data back and delete the old user. ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.