Multiple NFS exports not working?

IAmFromMars

Registered
I am trying to export a directory for multiple users on Mac OS 10.1.5, and it seems that it is only exporting one of the 3 directories I have setup for nfs exports.

I have originally created the exports with NFSManager, but also verified the results using NetInfo and everything seems to be setup OK, but when I check the exports with the command:

showmount -e

I only see one export.

Here is what is setup with NetInfo:

[jturpin:~] nidump -r /exports .
{
  "name" = ( "exports" );
  CHILDREN = (
    {
      "clients" = ( );
      "name" = ( "/Users/user2" );
      "opts" = ( "maproot=nobody" );
    },
    {
      "clients" = ( );
      "name" = ( "/Users/user1" );
      "opts" = ( "maproot=nobody" );
    },
    {
      "clients" = ( );
      "name" = ( "/Users/user3" );
      "opts" = ( "maproot=nobody" );
    }
  )
}

This is what showmount returns:

[jturpin:~] showmount -e
Exports list on localhost:
/Users/user2 Everyone
[jturpin:~]

Anyone know what is going on here?
 
I'm leaning towards a bug; after playing with this a bit, I noticed all but the first one cause mountd to log the following into /var/log/system.log:
Code:
Jun  9 02:10:53 myhost mountd[12981]: Can't change attributes for /exported/path.  See 'exports' man page.
Jun  9 02:10:53 myhost mountd[12981]: Bad exports list line /exported/path -ro
Do you see a similar error? What's odd is the entries, like yours, are identical...
 
Well, I was leaning the wrong way...this is actually the way it's supposed to work. The man page for exports is really, really, really (etc) vague on this point, but the FreeBSD Handlbook explains it much better. Basically, since all the mount points are under the same overall mount point (/Users), you need something like:
Code:
{
  "name" = ( "exports" );
  CHILDREN = (
    {
      "name" = ( "/Users/user2", "/Users/user1", "/Users/user3" );
      "clients" = ( "" );
      "opts" = ( "maproot=nobody" );
    }
  )
}
If you search for default entry on that FreeBSD handbook page, you'll see why this is so. FYI, mountd has a debug mode (undocumented in man) which I used to find this out; run mountd -d as root, and you'll see the multiple mentions of Adding a default entry.
 
Ok, you rule!

Its pretty amazing that this is not mentioned anywhere in the NFSManager documentation or in an Apple TIL document... I also did some farely extensive searching for this problem before posting, and did not come across any mention of this issue.

-johnny
 
For those interested, here is the snippet of documentation from the FreeBSD Handbook which explains what is going on here:

In /etc/exports, each line represents the export information for one filesystem to one host. A remote host can only be specified once per filesystem, and may only have one default entry. For example, assume that /usr is a single filesystem. The following /etc/exports would be invalid:


/usr/src client
/usr/ports client


One filesystem, /usr, has two lines specifying exports to the same host, client. The correct format for this situation is:


/usr/src /usr/ports client


The properties of one filesystem exported to a given host must all occur on one line. Lines without a client specified are treated as a single host. This limits how you can export filesystems, but for most people this is not an issue.

The following is an example of a valid export list, where /usr and /exports are local filesystems:


# Export src and ports to client01 and client02, but only
# client01 has root privileges on it
/usr/src /usr/ports -maproot=root client01
/usr/src /usr/ports client02
# The client machines have root and can mount anywhere
# on /exports. Anyone in the world can mount /exports/obj read-only
/exports -alldirs -maproot=root client01 client02
/exports/obj -ro


Props to blb for finding this info!
 
Ok, next problem, we know that we want the NetInfo exports folder to look like:


{
"name" = ( "exports" );
CHILDREN = (
{
"name" = ( "/Users/user2", "/Users/user1", "/Users/user3" );
"clients" = ( "" );
"opts" = ( "maproot=nobody" );
}
)
}
------------------------------------------------------------------------


but I have not been able to get NetInfo to allow this.

So, assumig the current state of my /exports entry in NetInfo contains one object with name="/Users/user1", one would assume that the next step is to select the name property and select "append value" from the Directory menu. This allows you to append a new value for the "name" group, but when done and saved, I get the following alert dialog (which as to be one of the most confusing alerts I have ever seen...)

"NetInfo Error - NetInfo write failed! (Operation succeeded)"

What? Regardless of the confusing dialog, the entry which I just added disappears, and I am left with the original lone /Users/user1 entry.

Any idea where the "exports" file lives in Mac OSX? It would be so nice to just be able to edit it without having to go through NetInfo...

-johnny
 
First thing to check, make sure NetInfo Manager is setuid root:
Code:
ls -l /Applications/Utilities/NetInfo\ Manager.app/Contents/MacOS/NetInfo\ Manager
should show
Code:
-rwsrwxr--  1 root  admin  180584 Jun  4 23:39 /Applications/Utilities/NetInfo Manager.app/Contents/MacOS/NetInfo Manager
If it does, anything interesting in /var/log/netinfo.log?
 
Ok, now I am realyl confused. I got the exports directory configured properly, but now I the mountd command doesn't seem to like the multiple paths per line. Here is the exports directory listing:

Code:
nidump -r /exports .
{
    "name" = ( "exports" );
    CHILDREN = (
    {
        "name" = ( "/Users/user1", "/Users/user2" );
        "clients" = ( );
        "opts" = ( "maproot=nobody" );
    }
    )
}

But now the showmount listing is empty:
Code:
[jturpin:/var/log] showmount -e
Exports list on localhost:
[jturpin:/var/log]
A look at the log shows this:
Code:
Jun 10 12:08:29 localhost mountd[257]: Bad exports list line /Users/user1 /Users/user2
 
Back
Top