NFS share per-host permissions

Hello,

I want to share a dataset via NFS and set a few IP addresses with read-write permission and a subnet with read-only permissions.

On linux the /etc/exports would look like this:

Code:

/storage/data 192.168.0.100(rw,root_squash,sync,no_subtree_check) 192.168.0.0/24(ro,root_squash,sync,no_subtree_check

)

How can I achieve this with TrueNas Scale 2024?

Two step process:

  1. Create the share with 192.168.0.100 as the host entry. This will create a RW entry for that host in /etc/exports.
  2. Create another share entry for the same path with 192.168.0.0/24 as the network entry. Select Advanced Options and check the Read Only checkbox.

This should give you the desired access. Note, that NFS uses ‘first match’ from /etc/exports. So, make sure to create the RW entry first.

If you follow the order above your /etc/exports should look like:

"/mnt/tank/nfs_dataset"\
        192.168.0.100(sec=sys,rw,no_subtree_check)
"/mnt/tank/nfs_dataset"\
        192.168.0.0/24(sec=sys,no_subtree_check)
2 Likes