On Wed, Sep 12, 2012 at 09:03:50AM +0100, Neil Bothwick 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.  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.  E.g. when root pmounts a
device and normal user tries to pumount it, I get...

waltdnes@d531 ~ $ pumount sdb1
Error: device /dev/sdb1 was not mounted by you

  Note also that the automount script has to first create a directory in
/media, before mounting it.  Since /media is drwxr-xr-x the directory
has to be created by root, or else I have to open up /media to writing
and directory creation by all users.  The most secure approach is to
have the system do things as root without user intervention, as much as
possible.

-- 
Walter Dnes <waltd...@waltdnes.org>
I don't run "desktop environments"; I run useful applications

Reply via email to