NFS

From HerzbubeWiki
Jump to navigation Jump to search

This page provides information on how to set up an NFS server on Debian Linux, and NFS clients on Mac OS X and Windows. My motivation to use NFS is that Samba is just too damn slow when I use it with the Mac OS X Finder.


Debian Packages

The following Debian packages need to be installed to be able to run an NFS server

nfs-kernel-server


References

Configuration file reference
man 5 exports
NFS on Linux Documentation
http://nfs.sourceforge.net/
Mount NFS share on Mac OS X
http://support.apple.com/kb/TA22243


NFS and RPC

TODO


Server configuration

/etc/exports

This file contains the definitions of the file systems that should be exported by the NFS server. For details about its format, see man exports.

/var/samba/media/DVD 192.168.1.0/255.255.255.0(ro,insecure,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

Discussion of the options used:

  • Path: The full path of the exported share must be specified
  • NFS client specification: Address/Netmask specification can be used to restrict clients based on their IP address. Single hosts may also be specified, as well as other formats
  • ro = Read-only
  • insecure = Allow clients to connect with client ports above 1000. This is required at least for Mac OS X.
  • no_subtree_check = Specifying this prevents a warning to be printed when the export is activated. I haven't thoroughly understood what this is for, but the man page recommends to use it: "[...] as subtree_checking tends to cause more problems than it is worth."
  • all_squash: Force all access to be made with anonuid/anongid. If this is not specified, the client will connect with uid/gid local to the client; since this does not match any uid/gid on the server, access will fail.
  • anonuid/anongid: Only numeric IDs can be used :-( I use the IDs for user/group = patrick/patrick.


After changes are made to /etc/exports, they must be activated by either restarting the server, or updating the list of exported shares:

/etc/init.d/nfs-kernel-server restart
exportfs -ra


Files in /etc/default/

The following files in /etc/default are also involved in configuring various aspects of NFS. Currently I am happy with all default settings.

  • /etc/default/nfs-kernel-server
  • /etc/default/nfs-common
  • /etc/default/portmap


/etc/hosts.allow, /etc/hosts.deny

Network access may be additionally configured via the following files:

/etc/hosts.allow
/etc/hosts.deny

TODO: Find out whether this is really important, or whether the client specification in /etc/exports is sufficient.


Authentication

TODO


Client configuration

Mac OS X

In the Finder

  • Select "Goto > Connect to Server"
  • Enter nfs://osgiliath.lan.herzbube.ch/var/samba/media/DVD
  • This will mount the share under /Volumes/DVD


In Terminal.app

  • Enter the following command to mount the share in a previously created directory
mount_nfs osgiliath:/var/samba/media/DVD /tmp/testnfs
  • Unmount the share
umount /tmp/testnfs


Windows

TODO