How to auto-mount a copied encrypted home

Posted by LedZ on Ask Ubuntu See other posts from Ask Ubuntu or by LedZ
Published on 2012-09-12T14:16:54Z Indexed on 2012/09/12 15:51 UTC
Read the original article Hit count: 279

Filed under:
|
|

How can I auto-mount and use my encrypted home that I copied to another partition on the same hard disk?

I'm running Ubuntu 11.10. My encrypted home is on sda1. There I've 2 users: userA and userB. Another partition is sda3 on which I have some other Data. BTW, sda1 is formatted as EXT4, sda3 is formatted as EXT3.

I did the following:

I logged out from GUI (Gnome) and changed (using Ctrl+Alt+F1) to the shell. From there I logged in, changed to sudo (using sudo -s) . After then I

created a new mountpoint (tmp) under /mnt (mkdir /mnt/tmp) mounted /dev/sda3 on that mountpoint /mnt/tmp (mount /dev/sda3 /mnt/tmp) copied my encrypted /home to /mnt/tmp using rsync (rsync --acvxASXH --progress --stats /home/ /mnt/tmp/).

After the “copy-procedure” I looked to my “new home” in /mnt/tmp and there I found the following 3 folders:

userA, 
userB,  
.ecryptfs

My structure for /dev/sda3 mounted on /mnt/tmp looks like the following (userB in ecryptfs I've not listed):

-userA
¦
+userB
¦   
+.ecryptfs
    ¦
    +userA
    ¦      + auto-mount
    ¦      + auto-umount            
    ¦      + Private.mnt
        ¦      + Private.sig
    ¦      +  wrapped-passphrase
    ¦      + .wrapped-passphrase.recorded
    ¦   
    + .Private  
             + (encrypted file_1)
             + (encrypted file_2)
             + (encrypted file_n)

Now I would like that this copy of the original home-directory should act with the same behavior as the original home-directory means, that it should be auto-mounted at reboot and give me access to my unencrypted files and after logout all my files should be encrypted again. Any suggestions?

© Ask Ubuntu or respective owner

Related posts about 11.10

Related posts about automount