SCIENTIFIC-LINUX-USERS Archives

October 2005

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Troy Dawson <[log in to unmask]>
Reply To:
Troy Dawson <[log in to unmask]>
Date:
Thu, 20 Oct 2005 11:37:01 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (73 lines)
chris.hunter wrote:
> I am trying to configure SL4.1 to allow users to mount hotplug 
> usb-storage devices.
> 
> SL4.1 has hal (hardware abstraction layer) configured, which calls 
> fstab-sync to add appropriate entries to fstab eg:
> 
> /dev/sdb1               /media/Windows          ntfs 
> pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
> /dev/sdb2               /media/Linux_backup     ext3 
> pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
> 
> 
> The appropriate folders are created under /media/ (owned by root).
> 
> However, only root has permission to mount these partitions.
> 
> My thoughts:
> i) pam is not configured to allow this. I don't know which pam module is 
> responsible for mounting block devices.
> ii) the "managed" fstab option is not working properly
> iii) shouldn't the /media mount points be owned by the user ?
> 
> Has anybody encountered this issue ?
> 
> Regards,
> 

Hi Chris,
Here's how to do it.
1st - Take a fresh S.L. 4.1 installed machine.  Don't do anything to the 
configuration.
2nd - plug in the usb-storage device, such as a usb thumb stick.
3rd - look in /media and what what new directory was created for the usb 
device.
4th - has the user, as themselves, mount that directory, such as
   mount /media/usbdrive
5th - the user is then able to use that mount point as themselves.

Tada :)

The reason I say have a fresh install, is because many people have 
broken HAL and hotswap putting in thier old workarounds.

The secret is in /etc/fstab, you will see something magically appear like
/dev/sda1               /media/usbdisk          vfat 
pamconsole,noatime,sync,exec,noauto,managed 0 0

This entry allows the users to mount that drive as themselves.  As far 
as permissions in the /media directory, here it is before

# ls -l /media
total 12
drwxr-xr-x  2 root root 4096 Oct 17 08:30 cdrecorder
drwxr-xr-x  2 root root 4096 Oct 17 08:30 cdrecorder1
drwxr-xr-x  2 root root 4096 Oct 20 11:34 usbdisk

and here it is after the user has mounted that directory (username has 
been changed to protect the innocent)

# ls -l /media
total 24
drwxr-xr-x  2 root   root  4096 Oct 17 08:30 cdrecorder
drwxr-xr-x  2 root   root  4096 Oct 17 08:30 cdrecorder1
drwxr-xr-x  4 userid usergroup  16384 Dec 31  1969 usbdisk

Troy
-- 
__________________________________________________
Troy Dawson  [log in to unmask]  (630)840-6468
Fermilab  ComputingDivision/CSS  CSI Group
__________________________________________________

ATOM RSS1 RSS2