How to set up a read-only NFS share?

Published on Aug. 22, 2023, 12:20 p.m.

To set up a read-only NFS share, you can modify the /etc/exports file on the NFS server to specify read-only permissions for the client(s) that will access the share. Here are the general steps:

  1. Locate the directory that you want to share via NFS on the NFS server.
  2. Add an entry to the /etc/exports file that specifies the directory to share, the IP address or hostname of the client machine(s), and read-only access permissions. For example:
/path/to/share client_ip_address(ro,sync,no_subtree_check)

Here, ro stands for read-only access, and the other options serve as explained previously. You can customize the permissions to fit your specific needs.

  1. Save the file and run the following command to apply the changes:
sudo exportfs -a
  1. On the NFS client machine, mount the share using the mount command, as described in the previous answer.
  2. Verify that the share has been mounted correctly and that read-only access is working as expected.

Tags:

nfs