Network File System (NFS) is a network file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed.
1. Setting up a NFS Server
The first step to setting up a NFS server is to edit the /etc/rc.conf file and add the following lines:
nfs_server_flags="-u -t -n 4"
Next, you have to set up /etc/exports file to define which machines have permission to which folders. The exports file looks something like this:
/data -maproot=user1 host1 host2 host3
/backup -alldirs host1 host2 host3
In this example the machines host1,host2 and host3 are given the privileges of the user1 for the /data directory.
For /backup they are given access to read from all directories within backup. And for /store only host2 is given access to read just the /store directory (make sure you replace hosts with your desired host names).
To start NFS server, enter:
rpcbind nfsd -u -t -n 4 mountd -r
2. Restarting the NFS Server
Once you have made changes to the exports file you need to restart NFS for the changes to take effect:
kill -HUP `cat /var/run/mountd.pid`Print This Post