[olug] Mounting Flash Drives as a user

Don E. Kauffman dekauff at cox.net
Sun Oct 30 23:13:42 UTC 2005


I've finally been able to play around with this a bit today and so far
what I've found out is that if the drives are mounted automatically the
system mounts them as root. If I umount them and then remount them as my
user then my user can access and umount them. I've not been able to
discover a way to automatically mount them as my user.

These are my mtab lines.

/dev/sdb1 /media/usbdisk subfs
rw,noexec,nosuid,nodev,sync,fs=floppyfss,procuid,user=dekauff 0 0
/dev/sda1 /media/USB20FD subfs rw,nosuid,nodev,sync,fs=floppyfss,procuid
0 0

I have one mounted as my user and the other is mounted as root.

These are my fstab lines:

/dev/sda1            /media/USB20FD       subfs
defaults,user,noauto,sync,fs=floppyfss,procuid    0 2
/dev/sdb1            /media/usbdisk       subfs
defaults,user,noauto,sync,fs=floppyfss,procuid    0 2

Does anyone see anything that might be of interest to change?

Don K.

On Mon, 2005-10-24 at 12:06 -0500, Christopher Cashell wrote:
> At Sun, 23 Oct 05, Unidentified Flying Banana Don E. Kauffman, said:
> > I'd like to know if there is a way to mount flash devices as a user --
> > not as root. Failing that I'd like to know if there is a way that one
> > can mount and unmount without having to be root. I'm using Suse 9.3. 
> 
> Taken from man mount(1):
> 
> ----
> (iii)  Normally,  only  the superuser can mount file systems.  However,
> when fstab contains the user option on a line, anybody  can mount  the
> corresponding system.
> 
> Thus, given a line:
>    /dev/cdrom  /cd  iso9660 ro,user,noauto,unhide
> any user can mount the iso9660 file system found on his CDROM using the
> command
>    mount /dev/cdrom
> or
>    mount /cd
> For more details, see fstab(5).  Only the user that mounted a filesys-
> tem  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 simi-
> lar  to the user option, with the restriction 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.
> ----
> 
> So, basically, you just need to setup a line in /etc/fstab that allows
> for the mounting of the flash drive with the user(s) option.
> 
> Something like this:
> 
> /dev/sdd1    /mnt/flash    auto   defaults,user,noauto      0     2
> 
> Should work.  Feel free to post snips of your /etc/fstab if you can't
> get it working.
> 
> > Don K.
> 




More information about the OLUG mailing list