MSDOS Filesystem question related to "read-only" files

Conrad Meyer cem at freebsd.org
Mon Nov 20 18:55:02 UTC 2017


Hi Karl,

In fact, msdosfs in FreeBSD should set the FAT READONLY attribute
under two conditions:

1. The owner chmod's the file non-writeable (chmod u-w) (what you've
described, I think).  Or,
2. The super user or otherwise privileged user sets the "readonly"
flag on the file via chflags(1).

How have you determined that chmod u-w does nothing?  What version of
FreeBSD are you using?

Best,
Conrad


On Mon, Nov 20, 2017 at 7:36 AM, Karl Denninger <karl at denninger.net> wrote:
> I'm running into an interesting issue here and wondering if there's a
> way to do this under FreeBSD.
>
> MSDOS filesystems have a "primitive" permission capability;
> specifically, they can have a "Read-only" attribute on a file.  It looks
> like OpenBSD supports this from reading their man pages.
>
> FreeBSD doesn't appear to.  When you mount a msdos filesystem (e.g. a
> USB stick) whoever owns the parent directory where you mount it gives
> you the permissions and "ownership" of files on said filesystem.  All
> good so far.  But attempting to chmod a file to remove write permission
> "succeeds" (returns success) but does nothing.
>
> Is this capability simply not present on FreeBSD?  I'm interested in
> using it as a means of "flagging" files on a USB stick in an application
> that I do not want to remove if the stick fills (basically, to "protect"
> them from being aged off) and it appears there's no way to do it, other
> than to use something unique in the filename that I would then have to
> pay attention to.
>
> --
> Karl Denninger
> karl at denninger.net <mailto:karl at denninger.net>
> /The Market Ticker/
> /[S/MIME encrypted email preferred]/


More information about the freebsd-fs mailing list