Re: NFS /etc/exports syntax

From: Marek Zarychta <zarychtam_at_plan-b.pwste.edu.pl>
Date: Tue, 20 Jan 2026 09:07:24 UTC
W dniu 20.01.2026 o 06:30, Steve Rikli pisze:
> 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
>
> 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?
>
> 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
>
>  From a readability standpoint, this seems clearer to me:
>    
>    /foo -maproot=root -ro -alldirs -network=1.2.3.4/24
>
> but I'm curious if there is a formal syntax definition for this stuff.
>
> Thanks,
> sr.

Hi Steve,

There is more than one valid strict approach when assigning options in 
the exports file. Both " " and "=" can be used, and the same applies to 
network masks. Please consult the source code if you have any doubts [1] .

[1]: 
https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/mountd/mountd.c#L2871

-- 
Marek Zarychta