You are not logged in.

#1 2016-12-28 14:17:52

slamhound
Member
Registered: 2011-07-26
Posts: 44

[SOLVED] Problems Automatically Mounting Encrypted Drive to /home/user

I am trying to move my home directory to an encrypted drive (using dm-crypt). I successfully installed a new drive, encrypted it, mounted it and moved all the files from my home directory to the new drive. I am now trying to automatically mount this drive to /home/user when I log in, but it isn't working. I followed the guide here: https://wiki.archlinux.org/index.php/Dm … g_at_login which says to create three scripts (savepass, securemount, and secureumount) and move them to /usr/local/bin, modify PAM configuration, create a systemd service and enable it. I thought I did everything correctly (I cut and pasted the script to avoid typos, I cut and pasted the UUID to avoid typos, and I did change the - to \x2d where necessary), but it is not working. According to systemctl status, the service fails to start when the process for the securemount script fails with status=2.

I am not sure how to go about troubleshooting this. Any advice on how to figure this out?

Last edited by slamhound (2016-12-28 15:12:56)

Offline

#2 2016-12-28 14:26:03

nesk
Member
Registered: 2011-03-31
Posts: 187

Re: [SOLVED] Problems Automatically Mounting Encrypted Drive to /home/user

slamhound wrote:

Any advice on how to figure this out?

Start deconstructing it - take a look at securemount script and run the commands in it, see which one fails and why.

Nitpick: you mount partitions, not drives.

Offline

#3 2016-12-28 14:50:43

slamhound
Member
Registered: 2011-07-26
Posts: 44

Re: [SOLVED] Problems Automatically Mounting Encrypted Drive to /home/user

Thanks; yes, I'm trying to work through, but I'm not completely sure when certain things are happening and whether I can just run these scripts (or the lines within the script) and whether they will be the same thing as what happens when the systemd service starts.

For instance, I did try running the important line in from the systemd service, which calls securemount, providing a user, the uuid of the encrypted drive, and the mount point (and yes, sorry, realized your point about mounting after I had written the title). It gives me an error message that says that the "savepass" script failed with exit code 126, and then gives me the message "No key available with this passphrase".

This surprised me because securemount doesn't call savepass. So now moving forward with troubleshooting, I'm not sure how to figure out the problem with savepass, as this seems to be called by PAM, but I am not clear when exactly this does this and whether I can just run savepass on its own to see what the problem is.

Offline

#4 2016-12-28 15:04:33

nesk
Member
Registered: 2011-03-31
Posts: 187

Re: [SOLVED] Problems Automatically Mounting Encrypted Drive to /home/user

slamhound wrote:

For instance, I did try running the important line in from the systemd service, which calls securemount, providing a user, the uuid of the encrypted drive, and the mount point (and yes, sorry, realized your point about mounting after I had written the title). It gives me an error message that says that the "savepass" script failed with exit code 126, and then gives me the message "No key available with this passphrase".

Can you post (in code tags) exact commands that you're running and outputs?
"No key available with this passphrase" error makes sense - the password is not in keyring when you're running this. Not sure how savepass script gets in there when you're running it manually.

Offline

#5 2016-12-28 15:09:31

slamhound
Member
Registered: 2011-07-26
Posts: 44

Re: [SOLVED] Problems Automatically Mounting Encrypted Drive to /home/user

Actually, I figured it out. This isn't quite clear from the guide I followed (but should have been obvious in retrospect) that to use this method, the user password must be the same as the passphrase to unlock the encrypted partition, as the user password is what is passed to securemount. Once I added that, everything worked.

Offline

Board footer

Powered by FluxBB