# [SOLVED] umount (eject) for a regular user

## cz0

Hi, folks!

Some time ago I wrote an udev rule + script, that helps me to mount a flashdrive. When a flashdrive inserted, the rule fires and make a folder in /mnt like flashN (where N is number of the flashdive starting from 0) and then mount that drive. Everything is fine, except 1 thing - I have to be root to be able to umount/eject it. Options like user or users does not help as they need flash drive to be listed in /etc/fstab .

Is there any solutions of that problem except adding user to disk group or let him make a passwordless sudo umount ?Last edited by cz0 on Sat Mar 27, 2010 10:45 am; edited 1 time in total

----------

## mikegpitt

Have you tried an automounting solution like halevt (successor of ivman)?  Halevt will automatically detect pluggable media and mount it under /media.  This can then be ejected as a regular user.

One tip when using halevt, you will want to comment out the lines in your /etc/fstab for those devices, since it won't automount anything inside there.

----------

## VoidMage

Considering the state of hal, halevt seems a dead end.

----------

## mikegpitt

 *VoidMage wrote:*   

> Considering the state of hal, halevt seems a dead end.

 Hal may be going away, but it's a good solution in the meantime... I don't know the timetable for the changes, but I am assuming that we won't see anything soon.

Out of curiosity, what is the next generation auto-mount solution?

----------

## VoidMage

It's a bit hard to tell now.

I don't know what xfce uses.

KDE4 uses hal backend in solid, though a few days ago a bug was filed in KDE bugzilla to

migrate to libudev.

Recent Gnome uses udisks (formerly DeviceKit-disks - a dbus layer upon libudev) as a backend for Nautilus.

I'm not sure if a recent platform independent solution exists.

----------

## mikegpitt

 *VoidMage wrote:*   

> It's a bit hard to tell now.
> 
> I don't know what xfce uses.
> 
> KDE4 uses hal backend in solid, though a few days ago a bug was filed in KDE bugzilla to
> ...

 So I guess udev alone will take the place of hal?

----------

## d2_racing

Or something that will talk with udev and devicekit.

----------

## cz0

So, no ideas how to let regular user to unount device, mounted by root?

----------

## Naib

if root actually mounted it... concider sudo rule on mount for users/wheel users

----------

## cz0

Well, I think, that udev uses root for it's operations, but I can use any other user, will it do?

----------

## cz0

The question is:

Is there is a way to mount partition/drive so any regular user can umount it without adding it to /etc/fstab ?

P.S. a "regular" user can be in disk group.

P.P.S. OK, lets imagine, that user, that I want  to be able to umount the partition is in disk group.

----------

## cz0

OK, got it working mostly as I want it to by adding the following line to /etc/sudorrs

```

%disk   ALL=(root) NOPASSWD: /bin/umount /mnt/flash[0-9],/usr/bin/eject /mnt/flash[0-9]

```

----------

