From: Eef Hartman on
Grant <omg(a)grrr.id.au> wrote:
> How do the permissions work on vfat? The bits are not there, are they?

They're faked by the vfat driver. The "w" bits are influenced by the
(no)readonly attribute (if the file is ReadOnly the attributes don't
include any "w" bits), the difference between owner/group/world and the
execute bits are handled by the driver (which means they're identical
for all files/subdirs and they cannot be changed by "chmod").
That's why the umask/fmask/dmask options are there for the mount,
to tell the driver something about WHICH bits to show/remove.

The slackware default is currently "umask=077", which means: only
access for the mounting UID, but this can be changed by the options
in the /etc/fstab file (and yes, this is also possible for auto-
mounted memory sticks etc. although you may need "by label" to
apply it the the right device file.

E.G: LABEL=UDiskPro_16GB /mnt/UDiskPro vfat uid="my_ID",fmask=033,dmask=022 0 0
(I normally don't bother about the group, it is fake anyway, but there
is a gid= option too).
Now when I put in my stick, it will be auto-mounted TO my ID, which
the right masks, under /mnt/UDiskPro
I only use /media for "stuff, NOT in the fstab file".

See the section about "Mount options for fat" in the man page for
the mount command (fat is a generic name for msdos and/or vfat).
--
******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M.Hartman(a)tudelft.nl - phone: +31-15-27 82525 **
******************************************************************
From: Grant on
On Tue, 08 Jun 2010 17:41:43 +0200, Eef Hartman <E.J.M.Hartman(a)tudelft.nl> wrote:

>Grant <omg(a)grrr.id.au> wrote:
>> How do the permissions work on vfat? The bits are not there, are they?
>
>They're faked by the vfat driver. The "w" bits are influenced by the
>(no)readonly attribute (if the file is ReadOnly the attributes don't
>include any "w" bits), the difference between owner/group/world and the
>execute bits are handled by the driver (which means they're identical
>for all files/subdirs and they cannot be changed by "chmod").
>That's why the umask/fmask/dmask options are there for the mount,
>to tell the driver something about WHICH bits to show/remove.
>
>The slackware default is currently "umask=077", which means: only
>access for the mounting UID, but this can be changed by the options
>in the /etc/fstab file (and yes, this is also possible for auto-
>mounted memory sticks etc. although you may need "by label" to
>apply it the the right device file.
>
>E.G: LABEL=UDiskPro_16GB /mnt/UDiskPro vfat uid="my_ID",fmask=033,dmask=022 0 0
>(I normally don't bother about the group, it is fake anyway, but there
>is a gid= option too).
>Now when I put in my stick, it will be auto-mounted TO my ID, which
>the right masks, under /mnt/UDiskPro
>I only use /media for "stuff, NOT in the fstab file".
>
>See the section about "Mount options for fat" in the man page for
>the mount command (fat is a generic name for msdos and/or vfat).

Thanks Eef, I think this info helps clarify fat/vfat filesystem access,
since we're stuck with it for portable memory devices :)

Grant.
--
http://bugs.id.au/
From: geep on
On Tue, 08 Jun 2010 15:37:08 +0200, Eef Hartman wrote:

> geep <geep(a)boursomail.com> wrote:
>> I have a disk shared by Linux and Windows - it's formatted vfat. If the
>> vfat disk is automounted then all the files belong to root and it's
>> impossible to change the owner with chown.
>
> That is easy to change in the /etc/fstab file options FOR that mount:
> e.g. uid=<that_users_id>,fmask=033,dmask=022 (makes all files owned
> by that UID, only writable FOR that uid and normal files do NOT have the
> execute bit, directories DO).

Thanks everybody. Problem fixed.
I also added gid, as ls -l showed the group as root instead of users.
fstab which I'm now using is:
/dev/hda1 /fat32 vfat
auto,user,rw,exec,uid=1000,gid=100,fmask=033,dmask=022 0 0

Cheers, Peter
First  |  Prev  | 
Pages: 1 2
Prev: route command question
Next: Mplayer question/problem