In order to get an encrypted home directory based on an encrypted file container mounted as a block device onto your home directory.
Based on the topic by oshunluvr that dealt with auto-mounting certain volumes for users upon login based on a bind mount so as to get these volumes accessible through the home directory.....
The answer by SteveRiley pointed to this documentation: https://wiki.archlinux.org/index.php/pam_mount
The goal is to replace eCryptfs, which encrypts individual files, with a LUKS or TrueCrypt container (encrypting the subtree as a whole) for the home directory of (every) user (excepting root).
Steve pointed out that libpam-mount is capable of mounting volumes for a user session.
Here is a recipe that will work with a dm-crypt (LUKS) container:
(Run everything as root.)
1. Install libpam-mount:
2. For each user, create a LUKS container using: (actually, you need the user's password for that)...
3. Make sure the root of that container is owned by the user:
4. Just mount it somewhere else so you can copy the home directory into it. Umount it again.
Repeat for other users.
5. Add to that file /etc/security/pam_mount.conf.xml:
6. Presto
Based on the topic by oshunluvr that dealt with auto-mounting certain volumes for users upon login based on a bind mount so as to get these volumes accessible through the home directory.....
The answer by SteveRiley pointed to this documentation: https://wiki.archlinux.org/index.php/pam_mount
The goal is to replace eCryptfs, which encrypts individual files, with a LUKS or TrueCrypt container (encrypting the subtree as a whole) for the home directory of (every) user (excepting root).
Steve pointed out that libpam-mount is capable of mounting volumes for a user session.
Here is a recipe that will work with a dm-crypt (LUKS) container:
(Run everything as root.)
1. Install libpam-mount:
Code:
apt-get install libpam-mount
Code:
user=<name> mkdir /home/$user/.luks/ pmt-edh -f /home/$user/.luks/$user.cont chown $user.$user /home/$user/.luks/$user.cont
Code:
mount /home/$user/.luks/$user.cont /home/$user chown $user.$user /home/$user umount /home/$user
Repeat for other users.
5. Add to that file /etc/security/pam_mount.conf.xml:
Code:
<lclmount>mount -t%(FSTYPE) %(VOLUME) %(MNTPT) "%(if %(OPTIONS),-o%(OPTIONS))"</lclmount> <volume fstype="crypt" path="/home/%(USER)/.luks/%(USER).cont" mountpoint="/home/%(USER)" options="fsck,noatime" />
- The password for the container must be the same as the password for the user login
- It will mount and unmount on console login and console su, but it will not unmount after you have had a (Lightdm) session.
- It will do this for every user that tries to login.
- It will mount the container on top of the home dir, but (usually) before you enter that directory, which means you get the 'fresh' view (which is the contents of the container)
- It will (the way it is now) also try to do it for root, but root has no /home/root ;-).
- You can change the line <volume .... to the archwiki line (or the one presented by pmt-ehd when it finishes creating the thing) which means you can make one line for every user with <volume user="xxx" ......................... /> so that each user is individually selected instead of all
- You could create a separate mount script that can be a little more intelligent, and that could also (?) transfer into mounting a truecrypt container instead.
- Apparently it passes the password onto the LUKS using the ...stdin, I presume. Since that works perfectly. (You can just pipe the password to mount)
- Why then not just use "truecrypt -k "" --protect-hidden=no %(VOLUME) %(MNTPT)" instead?
- The mount will hide the encrypted container from view, to unmount simply "umount" your home directory.
- ...
- It will ocassionally "fail" to dismount upon logout which may cause it to "fail" upon login again, but another logout will then fix that.
Comment