OS X: How to start the NFS daemon?
April 18, 2015 Leave a comment
I recently reactivated my backup Mac Mini as a server; for convenience, I installed the OS X Server package.
After fiddling a bit with the interface, I decided I actually need only two services, the File Sharing and Mail.
The file sharing configuration is straightforward. Given the very consumerist direction Apple is heading, I wasn’t very surprised to discover it does not provide any support for NFS (needed to access the calibre library, see the How to use calibre with a network drive? With NFS! post).
Fortunately, the NFS server configuration is not very complicated, and can be set by editing one single file, /etc/exports.
In a terminal, invoke an editor:
sudo vi /etc/exports
and add a line like:
/Volumes/Second HD/Harlescu Library -maproot=nobody 172.16.62.12
The first path is the folder to export; the optional address restricts access only to this host (more complex expressions are allowed, see the nfsd manual page).
To be sure that regular users cannot read this file, change the mode bits:
sudo chmod 640 /etc/exports
To check if the content of the configuration file is valid, use the checkexports command:
sudo nfsd checkexports
To make the NFS daemon start at boot, use:
sudo nfsd enable sudo nfsd start
To check the service status, use:
If necessary to restart the server, a pair of stop/start can be used, or a signal:
sudo kill -1 `cat /var/run/mountd.pid`
To see the NFS mount points, use:
The above configuration seemed to be the kind perform and forget, it worked from the first attempt and did not require further changes.