Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] USB automount
Date: Thu, 13 Sep 2012 08:35:59
Message-Id: 20120913093237.390944fd@hactar.digimed.co.uk
In Reply to: Re: [gentoo-user] USB automount by Walter Dnes
1 On Thu, 13 Sep 2012 02:50:27 -0400, Walter Dnes wrote:
2
3 > > I don't understand, why are you using sudo to run pmount when its core
4 > > purpose is to be run by normal users?
5 > >
6 > > % whatis pmount
7 > > pmount (1) - mount arbitrary hotpluggable devices as normal user
8 >
9 > A normal user can pumount *WHAT THAT SAME USER* has pmounted.
10
11 Ah, sorry. I didn't read your post carefully enough and saw pmount when
12 you were using pumount. Using sudo for that makes sense.
13
14 > Now try
15 > for a general solution. If you're the only user on the system, it's
16 > probably safe to keep an open xterm logged in to root. The problem is
17 > that inserting a USB device sets off a kernel event, that is passed to
18 > mdev, which looks for a script name in /etc/mdev.conf. If a script is
19 > found that matches the device spec (i.e. sd[a-z].*), e.g. my automount
20 > script, then the script is launched *AS ROOT*. Given that root has
21 > mounted the device, only root can unmount it.
22
23 It's exactly the same problem when udev is used to mount a device, which
24 is why I prefer to have a process running as the logged in user doing
25 that, whether it be something incorporated into the DE or a separate
26 daemon started from ~/.xinitrc.
27
28 It gets messy if you are running a multi-seat system, but if only one
29 user is running X at a time, it is the cleanest way. Of course, as you
30 are having mdev run a script, you could get that script to check which
31 user is logged into X and use su to mount it for them, avoiding the
32 umount issues.
33
34
35 --
36 Neil Bothwick
37
38 Like an atheist in a grave: all dressed up and no place to go.

Attachments

File name MIME type
signature.asc application/pgp-signature