Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] umount (eject) for a regular user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
cz0
Guru
Guru


Joined: 13 Jun 2005
Posts: 313
Location: /earth/russia/moscow

PostPosted: Sun Mar 14, 2010 12:38 pm    Post subject: [SOLVED] umount (eject) for a regular user Reply with quote

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
View user's profile Send private message
mikegpitt
Advocate
Advocate


Joined: 22 May 2004
Posts: 3224

PostPosted: Sun Mar 14, 2010 3:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sun Mar 14, 2010 5:06 pm    Post subject: Reply with quote

Considering the state of hal, halevt seems a dead end.
Back to top
View user's profile Send private message
mikegpitt
Advocate
Advocate


Joined: 22 May 2004
Posts: 3224

PostPosted: Sun Mar 14, 2010 7:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sun Mar 14, 2010 8:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
mikegpitt
Advocate
Advocate


Joined: 22 May 2004
Posts: 3224

PostPosted: Mon Mar 15, 2010 1:33 am    Post subject: Reply with quote

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
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Mar 15, 2010 1:38 am    Post subject: Reply with quote

Or something that will talk with udev and devicekit.
Back to top
View user's profile Send private message
cz0
Guru
Guru


Joined: 13 Jun 2005
Posts: 313
Location: /earth/russia/moscow

PostPosted: Mon Mar 15, 2010 7:56 pm    Post subject: Reply with quote

So, no ideas how to let regular user to unount device, mounted by root?
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6069
Location: Removed by Neddy

PostPosted: Mon Mar 15, 2010 8:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
cz0
Guru
Guru


Joined: 13 Jun 2005
Posts: 313
Location: /earth/russia/moscow

PostPosted: Tue Mar 16, 2010 6:52 am    Post subject: Reply with quote

Well, I think, that udev uses root for it's operations, but I can use any other user, will it do?
Back to top
View user's profile Send private message
cz0
Guru
Guru


Joined: 13 Jun 2005
Posts: 313
Location: /earth/russia/moscow

PostPosted: Tue Mar 16, 2010 6:59 am    Post subject: Reply with quote

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
View user's profile Send private message
cz0
Guru
Guru


Joined: 13 Jun 2005
Posts: 313
Location: /earth/russia/moscow

PostPosted: Sat Mar 27, 2010 10:45 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum