View previous topic :: View next topic |
Author |
Message |
cz0 Guru
Joined: 13 Jun 2005 Posts: 313 Location: /earth/russia/moscow
|
Posted: Sun Mar 14, 2010 12:38 pm Post subject: [SOLVED] umount (eject) for a regular user |
|
|
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 |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Sun Mar 14, 2010 3:14 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
VoidMage Watchman
Joined: 14 Oct 2006 Posts: 6196
|
Posted: Sun Mar 14, 2010 5:06 pm Post subject: |
|
|
Considering the state of hal, halevt seems a dead end. |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Sun Mar 14, 2010 7:10 pm Post subject: |
|
|
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? |
|
Back to top |
|
|
VoidMage Watchman
Joined: 14 Oct 2006 Posts: 6196
|
Posted: Sun Mar 14, 2010 8:48 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Mon Mar 15, 2010 1:33 am Post subject: |
|
|
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
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. | So I guess udev alone will take the place of hal? |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Mon Mar 15, 2010 1:38 am Post subject: |
|
|
Or something that will talk with udev and devicekit. |
|
Back to top |
|
|
cz0 Guru
Joined: 13 Jun 2005 Posts: 313 Location: /earth/russia/moscow
|
Posted: Mon Mar 15, 2010 7:56 pm Post subject: |
|
|
So, no ideas how to let regular user to unount device, mounted by root? |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6069 Location: Removed by Neddy
|
Posted: Mon Mar 15, 2010 8:39 pm Post subject: |
|
|
if root actually mounted it... concider sudo rule on mount for users/wheel users _________________ #define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0; |
|
Back to top |
|
|
cz0 Guru
Joined: 13 Jun 2005 Posts: 313 Location: /earth/russia/moscow
|
Posted: Tue Mar 16, 2010 6:52 am Post subject: |
|
|
Well, I think, that udev uses root for it's operations, but I can use any other user, will it do? |
|
Back to top |
|
|
cz0 Guru
Joined: 13 Jun 2005 Posts: 313 Location: /earth/russia/moscow
|
Posted: Tue Mar 16, 2010 6:59 am Post subject: |
|
|
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. |
|
Back to top |
|
|
cz0 Guru
Joined: 13 Jun 2005 Posts: 313 Location: /earth/russia/moscow
|
Posted: Sat Mar 27, 2010 10:45 am Post subject: |
|
|
OK, got it working mostly as I want it to by adding the following line to /etc/sudorrs
Code: |
%disk ALL=(root) NOPASSWD: /bin/umount /mnt/flash[0-9],/usr/bin/eject /mnt/flash[0-9]
|
|
|
Back to top |
|
|
|