[Techtalk] udev, how do I loathe thee...help please!

Akkana Peck akkana at shallowsky.com
Mon Nov 8 17:01:40 UTC 2010


Carla Schroder writes:
> On Sunday 07 November 2010 09:08:51 pm Akkana Peck wrote:
> > Note that gnome, hal, udisks and a bevy of other daemons and services
> > are supposed to handle all this for you and automount the card.
> 
> It does automount it-- in /media/[cardname], owned by root. FAT32 is no good 
> for files over 3.9 GB, and I would rather use a real filesystem anyway. So I 
> use ext2. 
> 
> According to man udev you can set permissions in udev rules, and the lords of 
> udev have been nattering at us for years that is the True and Correct Way, 

You can set permissions in udev rules, but that will only set the
permissions for the block device, /dev/sdc1 or whatever. You don't
care about that because /bin/mount is going to be run as root anyway.

What you care about is the filesystem after it's mounted, and
where it's mounted, not the block device it came from.
For that, you need to be configuring whatever is automounting it
(probably hal, but possibly udisks or something else, depending
on distro and desktop), not udev. Presumably there's a way to tell
those daemons to mount somewhere other than /media, but I bet it
won't be related to udev rules.

But if it's ext2, the permissions on the mounted filesystem will
be whatever they are on the filesystem -- numerically. If the
filesystem contains a folder called MyMusic and it's owned by
uid 1002, then whoever is UID 1002 on your workstation will own it.

Sometimes this can go wrong if you use multiple workstations
and you let the installer auto-generate your user account. Suppose
you have a Fedora system and an Ubuntu system, and the Fedora
installer generates your account with UID 1000 while the Ubuntu
installer generates it with UID 1002. Then you create a filesystem
on Ubuntu and copy stuff to it, try to mount it on the Fedora system
-- and you can't write to it because it's owned by this unknown user
number 1002, not by you, even though on the Ubuntu system 1002 was
"carla". I always create my own user and make sure the UID is the
same on all machines, for that reason, though I think there might
be some mount option you can use to remap one UID to another.

Is it possible that's the permissions problem you're seeing?

	...Akkana


More information about the Techtalk mailing list