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

Re: USB ownership



Hans Ekbrand wrote:

> On Fri, Oct 17, 2008 at 04:57:00PM +0200, Jochen Schulz wrote:
>> Paul Cartwright:
>> >
>> > My wife plugged in a USB stick, to save a file to it. It would not let
>> > her save a file, permission denied.
>> ...
>> > I am logged in first, vt7, she is logged in 2nd, vt8, and when I
>> > switched to my login, there was the disk window open ( /media/disk).
>> 
>> I don't know what Debian's current default solution for auto-mounting
>> is, but the problem is that this program simply cannot tell who of you
>> is using the USB drive.
> 
> I don't the last part of this sentence is accurate. Only one VT is
> current when the USB-stick is inserted, the automounter should use the
> policy: The user who own the VT which is active when the USB-stick is
> inserted gets write permission on it.
> 

He was posting only to me recently, so here is the solution tested.

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: