|
Exporting a File System for NFS - (/etc/exports)
by Jeff Hunter, Sr. Database Administrator
Overview
This article presents the methods for preparing a set of directories that can be exported to NFS clients using Linux. Under Linux this is can be accomplished by editing the /etc/exports file.About the /etc/exports FileFor the purpose of this example, I will be exporting (sharing) the directory /mnt/software.
The /etc/exports file contains an entry for each directory that can be exported to NFS clients. This file is read automatically by the exportfs command. If you change this file, you must run the exportfs command before the changes can affect the way the daemon operates.ExamplesOnly when this file is present during system startup does the rc.nfs script execute the exportfs command and start the nfsd and mountd daemons.
Edit the exports file vi /etc/exports and add:
/dir/to/export host1.mydomain.com(ro,root_squash) /dir/to/export host2.mydomain.com(ro,root_squash)Where:
- /dir/to/export is the directory you want to export.
- host#.mydomain.com is the machine allowed to log in this directory.
- The ro option mean mounting read-only.
- The root_squash option for not allowing root write access in this directory.
For this change to take effect you will need to run the following command on your terminal:
[root@linux2 /]# /usr/sbin/exportfs -a
/u01/app/oracle *(rw,no_root_squash)