Question concerning Hal, autofs, USB hard disks and ext2 fs

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sat Jan 21 23:13:10 UTC 2006


Oliver Andrich wrote:
> Hello,
> 
> after using Fedora Core 4 for a while and enjoying the integration of my
> various USB sticks and devices, I am currently looking into attaching a
> USB hard disk. Well, it basically works. I attach the device, turn it on
> and then the available partition gets mounted. So far so good.
> 
> First of all I would like to use ext2 on the disk, cause fat32
> feels a little bit strange to me. It is okay for USB Sticks and stuff,
> but not for a 250GB USB disk I want to use for backup and external
> storage. No problem, I can format the disk with ext2.
> 
> But here my problems and questions start:
> 
> - Why is a fat32 disk mounted under a mount point that is owned by the
>   current user?
> - Why isn't this the case with ext2 formated disks?
> - The result is, that I have an attached, mounted and ext 2 formatted 
>   USB disk, but contrary to the experience with fat formatted device, I
>   am not able to access the device as the user I am currently locked in.
> 
> Okay, I can do all the stuff I want as root, but why shall I want to
> do it? What I expect as a user is, that I can just use the disk as I
> would do with a fat disk.
> 
> I am perfectly aware, that ext2 has some other requirements and
> possibilities compared to fat32. But all this is irrelevant for a usb
> disk in my eyes. I just want the realiability of ext2. 
> 
> So, my question is, how can I change the behaviour of mounting an ext2
> usb disk in such a way, that it is comparable to the way a fat32 disk is
> mounted?
> 
> I hope my question and thinking behind it is understandable.
> 
> Best regards,
>   Oliver Andrich
> 
The reason a FAT partition is mounted as owned by the current user
is that FAT partitions do not support UID and GID. But ext2 file
systems do. So the partition is mounted, and access is controlled by
the file system itself. Now, what you could do is change the
permissions of the mount point, as root, after the file system is
mounted. (Or change directory to the mount point, and change
permission of .)

You can also create directories on the drive as root, and then
change ownership to the users you want to be able to use them.
As far as Linux is concerned, there is not difference between a
file system mounted from an IDE hard drive in the machine, and
a file system mounted from a removable drive. This includes USB
drives, ZIP disks, floppies, etc.

Now, if you really wanted to, I guess you could make a HAL rule that
would change permissions on the mount point after the file system
is mounted. The question is, do you really want to do this? About
the only time you might want to do this is if you are moving data
between systems with different UID and GID mapping.

Depending on what you are using the drive for, you may want to set
the drive up like the /tmp directory. Owned by root, r/w for
everyone, and the sticky bit set so that you can only change your
own files.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!




More information about the fedora-list mailing list