How to export an NFS share on a server?
Published on Aug. 22, 2023, 12:20 p.m.
To export an NFS share on a server, you will need to modify the /etc/exports
configuration file. Here are the general steps:
- Identify the directory that you want to share via NFS.
- Add an entry to the end of the
/etc/exports
file that specifies the directory to share, the IP address or hostname of the client machine, and the permissions for that client to access the share. For example:
/path/to/share client_ip_address(rw,sync,no_subtree_check)
Here, rw
stands for read/write access, sync
specifies that data will be written to disk immediately, and no_subtree_check
disables subtree checking for performance reasons. You can customize the permissions to fit your specific needs.
- Save the file and run the following command to export the NFS share:
sudo exportfs -a
This will export all the shares listed in the /etc/exports
file.
Note that you may need to restart the NFS service (sudo systemctl restart nfs
) for changes to take effect. Additionally, make sure that both the NFS service and any firewalls are properly configured to allow NFS traffic.