| How to set up NFS shares (or NFS exports) under Mac OS X*
Written 23 February 2002 to demonstrate the command-line method of sharing (or exporting) directories via the Network File System (NFS) under Mac OS X.
Note: NFS sharing can be a dangerous thingit is notoriously insecure. This article does not attempt to cover the security aspects of NFS sharing. You share file systems via NFS at your own risk.
I used the following information to successfully export an NFS share from Mac OS X to a commercial Unix system (an SGI Indigo2 running IRIX 6.5).
Daemons
You need the following daemons to run for NFS sharing to work:
portmap. Starting as root without any options seems to work.
nfsd. Start as root with the options -u -t (UDP and TCP threads).
mountd. Start as root with the path to the exports file you will create (I used /etc/exports).
Configuration File
You need a file which tells the NFS daemon which file systems to export. Note that most NFS daemons will not export directory structures that cross onto other partitions. That is, just because you export "/" (root), you won't necessarily get "/Volumes/some_cd_rom".
Even though the man page for mountd mentions /etc/exports, in my experience, you have to explicitly state the config file when starting it up. I was unable to determine where it may be looking for a default configuration file.
Minimum Required Contents of /etc/exports:
/Users/mwarner/Public
NOTE: this will leave the exported system with full write privileges to everybody!
Troubleshooting/Verification
° Use showmount -e to see what's exported and who has privileges.
° To see what's listening:
% rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100005 1 udp 929 mountd
100005 3 udp 929 mountd
100005 1 tcp 930 mountd
100005 3 tcp 930 mountd
Mounting the file system on the client
This works in Solaris and IRIX, but no guarantees with other OSes:
root# mount macosx:/Users/mwarner/Public /local_mnt_point
*"Shares" is the AT&T-flavor Unix term (i.e. Solaris and IRIX). "Exports" is the BSD-flavored Unix term.
Back to the Warner Technology Consulting Home Page
PGP Encryption Available for secured messages. Public key is available at MITs site or here.
|