/etc/exports - a strange restriction

Norbert Koch NKoch at demig.de
Thu Jul 21 14:36:52 GMT 2005


> Norbert Koch wrote:
> >>/usr/tinderbox -ro -alldirs -maproot=0:0 localhost
> >>
> > As far as I know, it is a restriction of the nfs specification.
> > If you only want to export a single directory, you could e.g.
> > use mount_null/mount_nullfs(8).
>
> Well, in my example remote host is localhost. But if I need to share
> files on a network?

I think I don't understand your problem here:

  /usr -ro -alldirs -maproot=0:0 -network 192.168.0.0 -mask 255.255.0.0
for an export into the local network 192.168.0.0/16.

  /usr -ro -alldirs -maproot=0:0 192.168.1.2
for an export to a specific host.

> I've made a quick look at RFC1813 but could not find this restriction.
> But why this restriction anyway for? It's very unconvenient.

I am no nfs expert. May be it is not a specification restriction
but an implementation restriction. But all references I found about
/etc/exports always speak about exporting a file system, not a directory.
And that seems to be so for other operating systems too.

So if I understand you right, this may work (for FreeBSD 5.x):
  # mkdir /tinderbox
  # mount_nullfs /usr/tinderbox /tinderbox
  # echo '/tinderbox -ro -alldirs -maproot=0:0 any_local_or_remote_host' >
/etc/exports

An other way to export /usr/tinderbox and all sub-directories is to specify
_all_ of them
in /etc/exports but w/o the -alldirs switch, e.g.:

  /usr/tinderbox /usr/tinderbox/dirA /usr/tinderbox/dirB -ro -maproot=0:0
any_host

See also the FreeBSD handbook chapter about nfs.


Norbert



More information about the freebsd-questions mailing list