Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to get pam_mount working on Ubuntu 12.04.

I have /dev/sda1 (encrypted partition) with /dev/dm-1 (ext4 formatted) inside it.

Should ~/.pam_mount.conf.xml be trying to mount /dev/sda1 or /dev/dm-1?

If I use the line:

<volume fstype="ext4" path="/dev/dm-1" mountpoint="~/slowstore" options="rw" /> 

then it nearly works. It prompts for the password (ok, I'd like pam_mount to do that for me, but still..) then I get:

pam_mount(rdconf2.c:126): checking sanity of luserconf volume record (/dev/dm-1)
pam_mount(rdconf2.c:132): user-defined volume (/dev/dm-1), volume not owned by user

If I do:

sudo chown nick:disk /dev/dm-1

Then re-login the encrypted partition mounts correctly (ignoring th fact I have to reneter the password). However, if I log out completely the ownership on /dev/dm-1 gets reset to root:disk.

What am I doing wrong?

share|improve this question
    
Have you played with noroot="1" option which man pam_mount.conf mentions? –  poige Feb 28 '13 at 0:39
    
Take a look at this solution: ubuntuforums.org/showthread.php?t=2130199 –  MountainX Jan 30 at 16:04
    
@MountainX that uses truecrypt, which isn't what I was trying to do at all. Thanks anyway. –  Nick Lothian Jan 31 at 9:59

2 Answers 2

up vote 1 down vote accepted

You should configure udev to automatically set permissions. See http://unix.stackexchange.com/questions/23955/permanently-changing-the-ownership-or-group-of-lvm-volume (reported here)

  • run udevadm info --query=all --name /dev/dm-1 to get volume group name (E: DM_VG_NAME=... line) and logical volume name (E: DM_LV_NAME=... line) of the partition (you may know them already though through other ways)
  • create a file (or modify one that looks like should hold custom rules/disk rules) in /etc/udev/rules.d/ adding the line

    ENV{DM_VG_NAME}=="..." ENV{DM_LV_NAME}=="..." OWNER="nick"

Of course, replace ... with relevant information.

Reload udev rules by rebooting if possible (so that you can test if it works at boot), or by running

sudo udevadm control --reload-rules

notes: if you create a new file in /etc/udev/rules.d it should be named DD-whatever.conf, where DD are two decimal digits. The rules are parsed in number order, so your rule should have an higher number than the system rule setting the default ownership values in order to override it. If it doesn't work, change the number to 95 or so

share|improve this answer
    
This looks right to me. –  Nick Lothian Aug 29 at 6:58
    
I also noticed that when I upgraded to 14.04 it seems to magically have started working. I haven't looked into what changed. –  Nick Lothian Aug 29 at 6:59
    
@NickLothian I guess the default rule for devices in udev has changed so that your user is in the group assigned to them –  pqnet Aug 29 at 7:11

This isn't really answering your question, so I wish I could leave it as a comment, but I think this link can help you out some. http://askubuntu.com/questions/73435/pam-mount-wont-automount-encrypted-partiton In the example they had, they pointed at the partition, set fstype to crypt, and defined a user in the line. Here's an example taken directly from the link, so believe me, I don't want to take credit for the answer. I hope that link helps!

<volume user="user" fstype="crypt" path="/dev/sda5" mountpoint="/media/personal" options="fsck,relatime" />

share|improve this answer
    
That looks pretty similar to what I have. I don't see anything that would fix the "volume not owned by user" problem (or am I missing something?) –  Nick Lothian Apr 27 '12 at 5:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.