|
File Sharing on Linux with Network File System
|
|
| Summary |
In Windows environment, file sharing is acheived by right clicking on the object you want to share,
then assign a new share name to this object. Other machines can access this shared files/directory/partition by browsing Network Neighborhood.
In Linux environment, file sharing can be done via network file system (NFS). In this document, Redhat Linux is the default environment. The purpose of
this document is to help get the system up and working. It is not meant to be used in production environment (you are free to do so). It does not provide
detail description about why it is done certain way. There are many other ways that yield the same result.
Readers should refer to Official Linux web site for the related HOWTO.
|
|
| Scenario |
There are two machines on the same network, Machine A and Machine B, both has Red Hat Linux on it.
The directory of "/tmp/shared" on Machine A will be shared by Machine B so Machine B can read the content from this directory. Let's call Machine A as Server and
Machine B as Client. The shared resources on Server can be anything and there can be more than one Client machines on the network which are going to use the
shared resources. From Server point of view, it exports the resources using NFS service comes with Linux distribution. From Client point of view, it mounts the
NFS resources from server. Setup described in this document allows Client to read from resources but not write to it.
|
|
| NFS Server Setup |
The following steps show how to export resources from server using NFS service. You must have root privileges.
|
|
| Client Setup |
There are not much special on Client side. Create a mount point
on Client machine. Mount point is just a directory on Client's filesystem where the shared resources will appear on. Edit the content
of /etc/fstab on Client machine and then mount the new shared resource. Here are the steps.
- As root, create a mount point on /tmp/mymount/ with this command .
- Add this line to /etc/fstab.
- SERVER_NAME is the name of NFS Server. IP address can be used instead.
- At command line, type .
- Now, directory /tmp/mymount will contain data from Server's /tmp/shared directory.
- Done.
|
|
| Some notes |
If it does not work for some reasons, do the following.
- Pay attention to IPTABLES or IPCHAINS setup. Make sure Server does not reject NFS packet.
- Check to see if NFS service is running on Server.
- Make sure NFS service is running on Client side as well.
- If it still does not work, search Google and refer to Linux Site for HOWTO.
|