USB mounting automatically : users option?

Cameron Hutchison lists at xdna.net
Tue Mar 3 23:26:56 UTC 2009


"Alan E. Davis" <lngndvs at gmail.com> writes:

>Is it possible to ensure that the files on the device will be readable and
>writable by the user who mounted the USB drive?

If it is a FAT filesystem or other filesystem that does not store the
user and group ID, then the user and group on the files must be chosen
at mount time, and all files on the filesystem get those IDs.

>I have done the following, and it may be working:

>  4. in fstab:
>        ####USB BLUE
>        LABEL=BLUE /media/BLUE ext2 defaults,users,rw,auto 0 0

However, since you are using ext2, the user and group IDs are stored by
the filesystem so there is no remapping of IDs when the volume is
mounted.

The only way around this is to synchronise the IDs on the different
machines. You can get away with using a GID in common and ensuring that
all the files use that group ID and have group rw[x] permissions. That
way, your owners can be different but the files still fully accessible
on each machine.

You will probably want want to use set-gid directories and a umask of
00X (X is usually 2 or 7). This means the files you create are group
writable (umask) and new files inherit the GID of the directory they are
in (set-gid directories).





More information about the ubuntu-users mailing list