[vox-tech] Re: vfat and permissions - anyone seen this before?
Ken Bloom
vox-tech@lists.lugod.org
Tue, 12 Mar 2002 17:07:36 -0800
>
>
>**Original Message**
>From: Ryan <ryan@mother.com>
>To: vox-tech@lists.lugod.org
>Subject: Re: [vox-tech] vfat and permissions - anyone seen this before?
>Date: Mon, 11 Mar 2002 18:24:34 -0800
>Reply-To: vox-tech@lists.lugod.org
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Vfat has some permission flags, hidden, system, archive, and read only.
>
>Perhaps you had one of these set?
>
>Windows usualy uses hidden and system to keep people from finding the sys=
>tem=20
>files to mess with them (windows won't let you see them unless you tell i=
>t to=20
>byy ajusting some settings.)
>
I thought of that but discounted it because I was always able to drag
files into those directories under Windows.
However, when I got your answer, I did a little bit of experimentation
using my roommate's computer, and a FAT formatted floppy disk. I touched
two files and created two folders on that floppy and proceeded to make
one of each read-only (using chmod -x):
drwxr-xr-x 2 bloom bloom 512 Mar 11 19:16 dir1/
-rwxr-xr-x 1 bloom bloom 0 Mar 11 19:16 file1*
-r-xr-xr-x 1 bloom bloom 0 Mar 11 19:16 filetobereadonly*
dr-xr-xr-x 2 bloom bloom 512 Mar 11 19:16 readonlydir/
I took the disk to my roommate's XP computer, and put it in. I looked at
the files and folders that were read-only there, and the list didn't
agree (although there were clearly some read-only files and dirs and
some read-write files and dirs).
I found I was able to drag files into the read-only directories under
windows, which may lend truth to the situation.
I was about to ask if anybody knew of official documenation about this,
but then I found the kernel code that seems to explain this:
/* /usr/src/linux/include/linux/msdos_fs.h line 192 */
#define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
(if the Read-Only attribute is set, permissions should be UMASK & 0555
otherwise they should be UMASK & 0777 )
In the reverse direction,
#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO)
if the file is not writable by everyone (it it isn't ugo+w) then the
read-only bit will be set.