[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: USB ownership



Emanoil Kotsev wrote:

> Florian Kulzer wrote:
> 
>> On Fri, Oct 17, 2008 at 21:29:09 -0400, Paul Cartwright wrote:
>>> 
>>> > 
>>> > The problem is that the automounter cannot make a direct connection
>>> > between a specific user session and the physical act of someone
>>> > plugging
>>> > in a new device.  It could probably be improved to make better
>>> > guesses, but it's impossible to know.
>>> > 
>>> 
>>> I can understand that. Can it be automounted with more permissions, like
>>> rw-rw--r for owner-group ??
>>> 
>>> since we are both users, and both in the same group, if group user could
>>> be rw that would solve it, no matter who owns it. She won't use the
>>> command like or know to look at files like fstab or mount/pmount.. she
>>> just wants to plug it in and copy files to/from it.
>> 
>> How can one user unmount the device cleanly if it has been mounted for
>> the other user?
>> 
> 
> I do it by including the 'users' mount option in fstab
> 
> see man mount
> 
> ----
> ....
>        For more details, see fstab(5).  Only the user that mounted a
> filesystem can unmount it again.  If any user should be able to
>        unmount, then use users instead of user in the fstab line.  The
>        owner
> option is similar to the user option, with the restric‐
>        tion that the user must be the owner of the special file. This may
>        be
> useful e.g. for /dev/fd if a  login  script  makes  the
>        console  user  owner  of  this device.  The group option is
>        similar,
> with the restriction that the user must be member of the
>        group of the special file.
> ....
> ----
> 
> 
There appears to be a malfunction somewhere on the way

Ok I created a second user on my notebook and tested it so now I'm 100% sure
how to do it.

for some reason the UUID label option is not working with KDE (may be it's
working only on boot) and I've used the users option only for NFS drives,
so didn't know this. I think there is a problem (BUG) with this UUID= in
fstab, but do not have time to log it - feel free  to do it and let me
know. I'll log it next week if you don't do it.

This is how it has to be done

1) with sudo vol_id -u device get the UUID from the usb drive partition you
want to edit
2) In the KDE -> 'System Settings' go to advanced and click 'Disk &
Filesystems'
3) switch to administrator by clicking on the admin button at the bottom +
password etc. - so now you are admin
3) click on the drive partition you want to mount (usb drive /dev/sdg1 in
your case)

3a) select the mount point /media/usb_XXXX in your case, or write down
something meaningful i.e. /media/usb_data_1_partition_1
3b) click by UUID and the UUID should be the same with the one you get in 1)
3c) click enable at start (optional)
3d) Slect "Mount Permission" -> Any user may enable disable
3e) click OK

4a) edit /etc/fstab replace UUID= as shown below for the UUID which you get
in 1)

/dev/disk/by-uuid/<UUID_FROM_STEP_1> /media/usb_XXXX auto
users,noauto,atime,rw,nodev,noexec,nosuid 0 0

4b) save and close

Test:
user 1 logs in - plugin the device .... open ... works
user 2 opens second kde session opens konqueror./dolphin -> safe remove
device - works

voila it all works

regards


Reply to: