Re: NFS /etc/exports syntax
- Reply: Steve Rikli : "Re: NFS /etc/exports syntax"
- In reply to: Steve Rikli : "NFS /etc/exports syntax"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Jan 2026 13:47:21 UTC
On Mon, Jan 19, 2026 at 9:30 PM Steve Rikli <sr@genyosha.net> wrote:
>
> There appear to be some inconsistencies in exports(5) man page, or at
> least a couple things which have me wondering a bit. :-)
>
> In particular I'm looking at the use of "=" (or not) between some flags
> and their args.
>
> E.g. the man page text has descriptions like:
>
> The third case is specified
> by the flag -network=netname[/prefixlength] and optionally -mask=netmask.
>
> but down in EXAMPLES the "=" is not used with those flags, like so:
>
> /cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
Both ways work, at least for "-network" and "-mask". ("-mask" is considered
deprecated in favour of the "1.2.3.4/24" syntax, but it works.)
>
> I've been using -network=1.2.3.4/24 syntax in my own exports and it
> seems to do the right thing, fwiw.
>
> Others like -maproot seem to more consistently use "=" in the man page,
> and I don't see instances with " " instead; I'm guessing it would work
> that way too, but haven't tried it.
>
> In general, are exports flags intended to work with either "=" or " "
> between the flag and its arg?
From a quick glance at the code, yes, the "=" and whitespace between
a flag and its argument are both handled the same.
The next flag is recognized by a "-" in front of the string.
>
> As an aside, the 'zfs set sharenfs' syntax examples from Handbook seem
> to use the "=" between flags and their args pretty consistently.
>
> Different but related, is there a syntax rule for "chaining" flags
> together after a leading "-"? E.g. is something like this valid:
>
> /foo -maproot=root,ro,alldirs -network=1.2.3.4/24
No, each flag must be separate with the "-" at the beginning of
it, from what I can see. (The parsing code is literally decades
old. It was first written in the late 1980s.)
>
> From a readability standpoint, this seems clearer to me:
>
> /foo -maproot=root -ro -alldirs -network=1.2.3.4/24
Not sure what you were asking about this line, but it
looks ok to me.
>
> but I'm curious if there is a formal syntax definition for this stuff.
Nope. It's very old C that has been hacked by many over the
years. I can barely figure out what it is doing when I look at it
and I've looked at it many times.
rick
>
> Thanks,
> sr.
>