This article assumes all required binaries are installed and focuses on configuring the filesystems to share and setting access rights.
Let's say we want to share the local /path/to/dir/ directory to the bob user existing on the server myServer (NFS client, having the IP address 10.121.32.209), with read-only access :
On the NFS server side :
- We must start by defining our shares. This is done in /etc/dfs/dfstab on Solaris (equivalent to /etc/exports on Linux)
- Syntax of a share definition :
share [ -d description ] [ -F nfs ] [ -o suboptions ] pathname
- -d description : (explicit). This option is of little use since there are no utilities to let an NFS client see this information.
- -F nfs : -F allows you to specify the type of fileserver to use. Since the share command supports just one fileserver (nfs) this option is currently redundant. Early releases of Solaris supported a distributed file-sharing system known as RFS, hence the historical reason for this option. It is conceivable that another file sharing system would be added to Solaris in the future. For clarity, you should specify -F nfs to ensure that the NFS service is used.
- -o suboptions : comma-separated list of options.
- Let's add to /etc/dfs/dfstab :
share -F nfs -o ro=10.121.32.209,anon=12345 /path/to/dir
12345 is alice 's UID. alice is a local account on the Solaris NFS server.
- Make sure the nfsd and mountd daemons are running : ps -ef | /usr/xpg4/bin/grep -E "(nfsd|mountd)$"
- Restart the NFS server to enable the new share : /etc/init.d/nfs.server stop; echo $?; /etc/init.d/nfs.server start; echo $?
- List the configured shares : share
- /path/to/dir ro=10.121.32.209,anon=12345 ""
On the NFS client side :