Configuring the NFS Client



Configuring the NFS Client

You also need to configure the NFS clients to mount their /home directories on the NFS server.

These steps archive the /home directory. In a production environment in which the /home directory would be actively used, you'd have to force the users to log off, back up the data, restore it to the NFS server, and then follow the steps below. As this is a lab environment, these prerequisites aren't necessary.

1.
Make sure the required netfs, nfslock, and portmap daemons are running and configured to start after the next reboot:

[root@smallfry tmp]# chkconfig nfslock on
[root@smallfry tmp]# chkconfig netfs on
[root@smallfry tmp]# chkconfig portmap on
[root@smallfry tmp]# service portmap start
Starting portmapper: [  OK  ]
[root@smallfry tmp]# service netfs start
Mounting other filesystems:  [  OK  ]
[root@smallfry tmp]# service nfslock start
Starting NFS statd: [  OK  ]
[root@smallfry tmp]#

2.
Keep a copy of the old /home directory, and create a new directory /home on which you'll mount the NFS server's directory.

[root@smallfry tmp]# mv /home /home.save
[root@smallfry tmp]# mkdir /home
[root@smallfry tmp]# ll /
...
...
drwxr-xr-x   1  root   root   11 Nov 16 20:22 home
drwxr-xr-x   2  root   root 4096 Jan 24 2003 home.save
...
...
[root@smallfry tmp]#

3.
Make sure you can mount Bigboy's /home directory on the new /home directory you just created. Unmount it once everything looks correct:

[root@smallfry tmp]# mount 192.168.1.100:/home /home/
[root@smallfry tmp]# ls /home
ftpinstall nisuser quotauser smallfry www
[root@smallfry tmp]# umount /home
[root@smallfry tmp]#

4.
Start configuring autofs automounting. Edit your /etc/auto.master file to refer to file /etc/auto.home for mounting information whenever the /home directory is accessed. After five minutes, autofs unmounts the directory:

#/etc/auto.master
/home /etc/auto.home --timeout 600

5.
Edit file /etc/auto.home to do the NFS mount whenever the /home directory is accessed. If the line is too long to view on your screen, you can add a \ character at the end to continue on the next line:

#/etc/auto.home
*    -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp \
     192.168.1.100:/home:&

6.
Start autofs and make sure it starts after the next reboot with the chkconfig command:

[root@smallfry tmp]# chkconfig autofs on
[root@smallfry tmp]# service autofs restart
Stopping automount:[  OK  ]
Starting automount:[  OK  ]
[root@smallfry tmp]#

After doing this, you won't be able to see the contents of the /home directory on Bigboy as user root. This is because by default NFS activates the root squash feature, which disables this user from having privileged access to directories on remote NFS servers. You'll be able to test this later after NIS is configured.

Note

This automounter feature doesn't appear to function correctly in my preliminary testing of Fedora Core 3. See Chapter 29, "Remote Disk Access With NFS," for details.


All newly added Linux users will now be assigned a home directory under the new remote /home directory. This scheme will make the users feel their home directories are local, when in reality they are automatically mounted and accessed over your network.