![]() |
NFS
Author mikea@norfolk.nf
Applicability Caldera 2.2/3 mostly.
NETWORK FILE SERVER
If you come from a windoze background and are looking for something similar to 'Network Neighbourhood', you have come to the right page.
NFS allows you to mount another computer's files and directories as part of your own file system. It behaves identically to the way you mount a cd or floppy device, and, even uses the mount command. Once the underlying details are covered you can access other computer files (and directories) in the same way you would normally. Eg using the console commans cd and ls -l and / or the KDE Home icon browser.
These steps do NOT cover security issues. The man pages for nfs are quite adequate. These steps concentrate solely on getting that damn connection established.
You are advised to read up on 'NFS' in the network and security guide (NAG) document after completion of these steps. The document is well written (for a change) and gives you excellent insight in 'what to do' to improve on these basic steps.
Step zero: Light reading
Dont be impatient, read this:
You the client machine, will access the server machine using 'fully qualified domain names'. In turn, the server will interrogate the client for 'authentication' in the same manner. Domain names of any kind resolve to ip addresses of the form a.b.c.d You do not need to know too much about either. But you do need to know what the names and numbers are for both machines.
The steps below assume a theoretical connection on an ethernet as follows
| client | server | location | |
| name | my.client | my.server | /etc/HOSTNAME |
| ip | 192.168.1.8 | 192.168.1.1 | /etc/sysconfig/network-scripts/ifcfg-eth0 IPADDR=192.168.1.8 |
The ip addresses above are typical on a local ethernet. The domain names are fanciful but used throughout this Step. Obviously, replace the word my.client with the real name of each machine. You can find the real names of each machine and the ip address used in the files specified by 'location'. If you are not using an eth0 (ethernet lan) i can't help you.
For your sanity write down the information from the 'locations' specified above.
STEP1: The NFS Server
The client (you) needs an NFS server running on the targeted computer. On that computer, as root, edit the following files
/etc/host.conf
make sure the entry says
order hosts, bind
this is important for your sanity, you are telling the server computer to look for machine names locally in a file called /etc/hosts before going to the wide blue yonder (the internet).
edit /etc/hosts
add to this file the following entry;
192.168.1.8 my.client
what this says (to the server) is that a domain name known as my.client is on ip address 192.168.1.8.
you can call this name and your machine HOSTNAME ANYTHING you like (it is *your* network).
edit
/etc/exports
enter the following
/ my.client (rw)
what this says to the server is, when an nfs request comes in from a machine called my.client, it will mount root directory as rw (not quite, but take it as gospel for now).
STEP TWO: Start the daemons
/etc/rc.d/init.d/nfs stop
/etc/rc.d/init.d/nfs start
the first line simply garantees that if the nfs daemon was running, it isn't anymore.
the above should come back at you and tell you the following services (at least) are now running
mountd and nfsd daemon. if errors are reported, examine the output of /var/log/messages
tail -100 /var/log/messages | grep nfs
If you touch any of the files mentioned in step one, you *must* restart nfs in step two.
STEP 3: set for boot time
A simple requirement now, is to ensure nfs comes up at boot time (should you ever reset your machine) god forbid. This is held in the /etc/rc/rc.X files. Assuming you are running in runlevel 5
ls -la /etc/rc.d/rc.5/ | grep nfs
if the file listed starts with a K change it to S
There is of course a simpler way in COAS-SYSTEM-DAEMONS
simple check nfs server box.
You have now finished with the server. NFS is now running. The following steps apply to your client called my.home
STEP 5 make a convenient nfs server directory
mkdir /server
STEP 6: mounting
edit your /etc/fstab and place an entry as follows
my.server:/ /server nfs timeo=14,intr,user,noauto
this line says mount the root directory on the machine called my.server to a local directory called /server. Allow users to mount it and don't fire up at boot time (noauto).
STEP 6:
as either a user, or root enter
mount /server
ls -la /server
you should see the contents of the server's root directory
and of course
umount /server disconnects from the server machine.
STEP 7: Authentication.
if you mount the server as root, the nfs daemon takes one look at that and automatically converts you to user nobody. It will NOT let you access it as a root superuser.
if you mount the server as a mortal, the nfs daemon assumes you have an identical account on it. By identical, not only must your username be the same, but in fact, you user id (UID). To fix that, the *easiest* solution is to have BOTH machines with identical users and user id's. You could of course simply create new users with those id's, or you could edit one OR the other /etc/passwd file and change the uid so they match. (Naturally, it must be unique user id's in the actual passwd files). A secondary step is to chown your home directory on the same machine so that the files reflect the new uid.
STEP MANY:
These are the rudiments of connection to a file server. There are many issues to surmount, not least is security. There are many variations on the theme (with regards to which directory is accessible, and mounted). Allowing any /some /all local ip addresses in. Using no_daemon options to convert user id's. They are well beyond the intent of this SxS, and you are referred to man pages starting with man nfs for further options.
ENJOY!