Using NFS To Share Files
Using NFS To Share Files
NFS (Network File System) is another way of sharing files across a network. It is used primarily in
Linux and UNIX systems, although there are NFS clients for Windows.
Installing NFS
1.
Configuring NFS
Configuration of NFS is pretty simple. You add the directories you wish to export to the file
/etc/exports.
2.
3.
4.
*(ro,sync)
In the following screen capture, you can see how I configured /etc/exports to share /public:
NFS requires the rpcbind service to be running. Start it with the following command:
service rpcbind start
9. Enable the export immediately with the command exportfs -v. You can view the export with the
command showmount -e.
If you are using a firewall, you must explicitly allow traffic from your local subnet to access the
server.
For more information, see chapter 10 on Linux security.
You can also create a new directory on your client and mount the NFS export to the directory, thus
giving you access to the files in the directory:
Figure 9: Creating and viewing a mount point for the NFS share.
In the above example, I mounted the export from LinuxServer01 (/public) to a directory on my local
client machine, called ubuntuServer02. As you can see, after it was mounted, I was able to view the
contents of the exported directory locally.
-a--archive mode, which allows copying files recursively, plus it preservers symbolic links,
user and group ownership, file permissions, and timestamps
-e--specifies the remote shell to use. This option allows you to use SSH for the transfer
-u--updates only files that have changed since the last rsync
-v--verbose
-z--compress data