Automatically mounting USB w/o GUI?
Tom Buskey
tom at buskey.name
Tue Jul 27 16:40:49 EDT 2010
On Tue, Jul 27, 2010 at 3:36 PM, Benjamin Scott <dragonhawk at gmail.com>wrote:
> On Tue, Jul 27, 2010 at 10:01 AM, Tom Buskey <tom at buskey.name> wrote:
> > I want my USB drive to show up mounted on /media/<some label> after I
> plug
> > it in. I don't mind having to type something on the command line to
> trigger it.
>
> I can describe one way to do this.
>
> A1. Set-up devfs or hotplug or udev or DeviceKit or whatever it is
> this week to give your USB flash storage device a consistent name
> under /dev/ Let's say /dev/foo but you could use /dev/sandisk or
> /dev/jumpdrive or whatever you like.
>
I think that's what I want
>
> A2. Add an entry to /etc/fstab associating /dev/foo with /media/foo
> (or /mnt/foo or whatever); give it a mount option of "users" so that
> any user can mount it
>
> A3. Now, when you plug in the flash thingy, you can do "mount
> /media/foo" and it will mount. You don't need to be root.
>
> If you want, you could also add:
>
> A4. Use automount/autofs/amd/whatever, so that when a user attempts to
> access /auto/foo, the system automatically tries to mount /dev/foo on
> /auto/foo. Optionally, create a symlink from /media/foo to /auto/foo
> to make that more obvious.
>
And combine this with A1.
>
> If the flash device is FATor some other non-Unixy filesystem:
>
> A5. Add uid/gid/umask/dmask options to the /etc/fstab entry so that
> the appropriate users can read/write the mounted filesystem.
>
>
I have a link earlier in the thread that is supposed to do this with udev
which is the flavor of the week over devfs. The link could also handle
different OS types on the same device (I might reformat my USB device).
> One attribute of this approach is that other than step A1, all steps
> use standard Unix techniques which have been around since before USB
> was even invented. I strongly prefer this building block approach,
>
I've used mount by user options in fstab before. I'm going to dig around
with udev.
I was really hoping for a "let any user mount any usb device w/o root or
sysadmin knowledge". This is for my own system but I'll extrapolate for
work situations.
For example, I have a user that receives USB drives from a customer that
needs to review & transfer data. Maybe a drive a week. The user
doesn't/can't have root. There might be multiple drives plugged in.
> rather than the "throw everything out and start from scratch with
> every problem" that seems to have invaded Linux in the past few years.
>
Yeah, I agree. Mounting CDs and USB drives has never been standard amongst
Unixen.
There's also been a tendency to only do things in the GUI. Instead of
running /usr/bin/gpk-application, they hide it in the GUI menu as
system->administration->add/remove software. I can ssh in and run
gpk-application, but I don't have a menu to click.
>
> IMO. YMMV. HTH. HAND.
>
> -- Ben
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20100727/2ea3fc82/attachment.html
More information about the gnhlug-discuss
mailing list