Can root mount a partition and allow users to write to it?
Walter Dnes
waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Thu May 17 22:56:42 UTC 2012
On Thu, May 17, 2012 at 02:01:42PM -0400, Scott Sullivan wrote
> In this case we need more information from Walter as to what his
> environment and requirements are.
>
> An important note here is the most auto-mount functionality/policy is
> actually implemented in/at the Desktop Environment level. There is
> currently no core agreed upon infrastructure to handle this. GNOME just
> mounts anything when it's inserted, KDE 4 doesn't auto-mount a partition
> until you try to navigate to it via File Browser.
>
> Try logging out of your X environment and switching to the console,
> you'll quickly find that nothing gets auto-mounted.
This is totally different from what most of you have worked with,
unless you do embedded stuff using busybox. Here's the background...
* I'm sure most of you have heard of how udev is now broken under a
separate /usr without initramfs, requiring many people to either
implement initramfs or reshuffle their partitions to make udev work.
* How many are aware that udev source code has been rolled into the
systemd tarball? See posting at
http://thread.gmane.org/gmane.linux.hotplug.devel/17392 Note that the
date is April 3rd, not April 1st.
* Yes, the posting claims that they will support non-systemd systems,
and that "For us, compatibility is key". Then again, they weren't
very concerned about users with a separate /usr partition.
Whining about "Poettering-ware" doesn't accomplish anything. I'm not
a programmer, so I can't fork udev. However there is already a
lightweight version, called "mdev," built into busybox. I'm fortunate
to be using Gentoo, which allows fine-grained customization, including
the ability to replace udev with mdev. I'm the rabble-rouser who
started what became https://wiki.gentoo.org/wiki/Mdev Most of what's
there now is other people's contributions.
I'm perfectly OK with manually mounting stuff, but some people really
like automount. I'm trying to figure out how to do that, to make the
mdev option more popular. Google turns up plenty of examples on the web
of instructions on how to implement automount under busybox/mdev. But
they're all for embedded single user systems, where the single user is
root.
mdev acts as the device manager and hotplug handler on my home
computers. Hotplug events are directed to a script as specified in
/etc/mdev.conf, and the device nodes (e.g. /dev/sdb, /dev/sdb1, etc) are
created. It's trivial to add a couple of lines to the script like...
mkdir -p /media/$MDEV
mount -t auto blah blah blah /media/$MDEV
...where MDEV is an environmental variable, with the device name, passed
to the script by the hotplug handler. My question is what exactly do I
have to do to make the mount writeable and unmountable by ordinary
users, even though the mount was created by root? If you're going to be
writing to a USB key, you want to unmount gracefully before yanking it
out. A sync might be sufficient, but I'd prefer something that handles
it gracefully.
Yes, I know I'm re-inventing the wheel.
--
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list