Linux is an operating system that was born on the Internet, so it is not surprising that it has strong networking capabilities. This makes Linux an excellent server, but it also allows Linux to be an excellent desktop workstation, especially in a highly networked environment. Fedora lets you easily set up your users with a portable desktop that follows them from computer to computer. With other leading desktop operating systems, it is not nearly as easy.
Normally, a Linux user’s home directory is located within the /home directory. As an alternative, within the home directory you can create a directory named after the system’s host name. Within that directory, create the users’ home directories. Thus, on a Linux system named dexter, the user mary would have a home directory of /home/dexter/mary instead of /home/mary. There is a very good reason for doing this.
If you are logged into the Linux system ratbert and would like to access your home directory on dexter as if it were stored locally, the best approach is to use Network File System (NFS) to mount dexter’s /home directory on the /home on ratbert. This results in having the same contents of your home directory available to you no matter which machine you log in to.
You can read more about NFS in Chapter 18.
To mount dexter’s /home directory as described, you would add a line similar to the following in ratbert’s /etc/fstab file:
dexter:/home /home nfs defaults 0 0
You would also add an entry such as the following in dexter’s /etc/exports directory:
Now, when ratbert boots up, it automatically mounts dexter’s home partition over the network. This enables you to treat the remote files and directories on dexter’s /home as if they are locally stored on ratbert. Unfortunately, this has the side effect of "covering up" ratbert’s actual /home directory.
This is where the extra directory level based on the system name comes to the rescue. With all of dexter’s home directories located in /home/dexter and all of ratbert’s home directories located in /home/ratbert, we can remove the danger of one system covering up the home directories of another. In fact, let’s take this example one step further: Imagine a scenario in which the systems dexter, ratbert, and daffy all have portable desktops that are shared with the other systems. The /etc/fstab and /etc/exports files for each system should have the following lines added to them as indicated.
The /etc/exports and /etc/fstab files for dexter are as follows:
ratbert:/home/ratbert /home/ratbert nfs defaults 0 0 daffy:/home/daffy /home/daffy nfs defaults 0 0
The /etc/exports and /etc/fstab files for ratbert are:
dexter:/home/dexter /home/dexter nfs defaults 0 0 daffy:/home/daffy /home/daffy nfs defaults 0 0
The /etc/exports and /etc/fstab files for daffy are:
ratbert:/home/ratbert /home/ratbert nfs defaults 0 0 dexter:/home/dexter /home/dexter nfs defaults 0 0
As you can see, each system uses NFS to mount the home directories from the other two systems. A user can travel from server to server and see exactly the same desktop on each system.