Running Linux, 5th Edition - Matthias Kalle Dalheimer [316]
linux:~ # rpcinfo -p frodo
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused
This means that the portmapper service that provides the RPC capabilities has been shut down. This may have been done to permit some maintenance procedures to be performed, or the server may be in the process of being shut down.
By now, you should be getting some clues for finding and diagnosing NFS availability as well as potential causes of NFS problems.
Manual mounting of NFS filesystems
It is possible to determine what NFS filesystems are currently mounted on your Linux system by using the mount utility:
linux:~ # mount -t nfs
merlin:/data on /data type nfs (rw,addr=192.168.1.4)
merlin:/srv on /msrv type nfs (rw,addr=192.168.1.4)
sunsol:/export on /mnt type nfs (ro,addr=192.168.1.6)
The NFS filesystem resources from the machine merlin have been mounted so that they are capable of read/write access. The resource on the machine sunsol has been mounted with read-only access capability.
Assuming you want to mount the /export/work resource from the machine sunsol on your Linux workstation at the directory mount point /home/work, here is the command to use:
linux:~ # mkdir /home/work
linux:~ #mount sunsol:/export/work /home/work
The df command will help to show that it is mounted, as well as the disk space available:
linux:~ # df /home/work
Filesystem 1K-blocks Used Available Use% Mounted on
sunsol:/export/work 17645600 3668352 13800800 21% /home/work
When it is necessary to unmount an NFS mounted resource, simply do this:
linux:~ # umount /home/work
With a little practice, you will soon be an expert at using the NFS client facilities.
Adding a directory to the NFS server's exports
As we said earlier, we will not try to tell you how to configure an NFS server, but we'll briefly explain how to export a directory once the server is running. In our example, the system administrator for the allison server must configure it to export the given directory (here, /usr) to your system. On most Unix systems, this is simply a matter of editing a file, such as /etc/exports, or running a command that edits the file. It is not necessary for the exported directory to be the root of a filesystem itself; that is, a server can export /usr even if /usr does not have its own separate filesystem.
Let's take the role of an administrator on an NFS server now and export the /data/accounts directory for use by all NFS clients in the myworld.org DNS domain. These simple steps will achieve this:
Create the /data/accounts directory: linux:~ # mkdir -p /data/accounts
linux:~ # chmod 770 /data/accounts
linux:~ #chown bill:accounting /data/accounts
These commands created the exported directory (it did not exist previously), set the permissions so that group members can access the directory, and then set permissions so that the accounting group can read and write to the directory. Of course, they can also list any files that may be placed within it.
Create the /etc/exports file with the following contents: /data/accounts *.myworld.org(rw,no_root_squash,sync)
Set the ownership and permissions on this file: linux:~ # chown root:root /etc/exports
linux:~ #chmod 644 /etc/exports
Configuring Your System as an NIS Client
NIS is not a tool for file and printer sharing, but we present it in this chapter because it shares some components with its cousin NFS, and because it can make NFS easier to administer because NIS allows each user to have the same account number on all systems.
NIS is a complex system, simply because it is so flexible. It is a general-purpose network database system that allows your machine to transparently access information on user accounts, groups, filesystems, and so forth, from databases stored across the network.
One goal of NIS is to ease network management. Allowing user account information (such as that stored in /etc/passwd) to be maintained on a single server,