On Thu, 13 Sep 2012 02:50:27 -0400, Walter Dnes wrote:

> > I don't understand, why are you using sudo to run pmount when its core
> > purpose is to be run by normal users?
> > 
> > % whatis pmount
> > pmount  (1)  - mount arbitrary hotpluggable devices as normal user  
> 
>   A normal user can pumount *WHAT THAT SAME USER* has pmounted.

Ah, sorry. I didn't read your post carefully enough and saw pmount when
you were using pumount. Using sudo for that makes sense.

> Now try
> for a general solution.  If you're the only user on the system, it's
> probably safe to keep an open xterm logged in to root.  The problem is
> that inserting a USB device sets off a kernel event, that is passed to
> mdev, which looks for a script name in /etc/mdev.conf.  If a script is
> found that matches the device spec (i.e. sd[a-z].*), e.g. my automount
> script, then the script is launched *AS ROOT*.  Given that root has
> mounted the device, only root can unmount it.

It's exactly the same problem when udev is used to mount a device, which
is why I prefer to have a process running as the logged in user doing
that, whether it be something incorporated into the DE or a separate
daemon started from ~/.xinitrc.

It gets messy if you are running a multi-seat system, but if only one
user is running X at a time, it is the cleanest way. Of course, as you
are having mdev run a script, you could get that script to check which
user is logged into X and use su to mount it for them, avoiding the
umount issues.


-- 
Neil Bothwick

Like an atheist in a grave: all dressed up and no place to go.

Attachment: signature.asc
Description: PGP signature

Reply via email to