Page 181 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 181
Unit 10: File System
Configuring NFS notes
NFS configuration is a relatively straightforward process. The processes that need to be running
can all start at boot time with a few modifications to your /etc/rc.conf file.
On the NFS server, make sure that the following options are configured in the /etc/rc.conf file:
rpcbind_enable=”YES”
nfs_server_enable=”YES”
mountd_flags=”-r”
mountd runs automatically whenever the NFS server is enabled.
On the client, make sure this option is present in /etc/rc.conf:
nfs_client_enable=”YES”
Each line in /etc/exports specifies a file system to be exported and which machines have access
to that file system. Along with what machines have access to that file system, access options may
also be specified. There are many such options that can be used in this file but only a few will
be mentioned here. You can easily discover other options by reading over the exports manual
page.
Here are a few example /etc/exports entries:
The following examples give an idea of how to export file systems, although the settings may
be different depending on your environment and network configuration. For instance, to export
the /cdrom directory to three example machines that have the same domain name as the server
(hence the lack of a domain name for each) or have entries in your /etc/hosts file. The -ro flag
makes the exported file system read-only. With this flag, the remote system will not be able to
write any changes to the exported file system.
/cdrom -ro host1 host2 host3
The following line exports /home to three hosts by IP address. This is a useful setup if you
have a private network without a DNS server configured. Optionally the /etc/hosts file could
be configured for internal hostnames. The -alldirs flag allows the subdirectories to be mount
points. In other words, it will not mount the subdirectories but permit the client to mount only
the directories that are required or needed.
/home -alldirs 10.0.0.2 10.0.0.3 10.0.0.4
The following line exports /a so that two clients from different domains may access the file
system. The -maproot=root flag allows the root user on the remote system to write data on the
exported file system as root. If the -maproot=root flag is not specified, then even if a user has root
access on the remote system, he will not be able to modify files on the exported file system.
/a -maproot=root host.example.com box.example.org
In order for a client to access an exported file system, the client must have permission to do so.
Make sure the client is listed in your /etc/exports file.
In /etc/exports, each line represents the export information for one file system to one host. A
remote host can only be specified once per file system, and may only have one default entry.
Example: Assume that /usr is a single file system. The following /etc/exports would be
invalid:
# Invalid when /usr is one file system
/usr/src client
/usr/ports client
LoveLy professionaL university 175