New ZFS Sharing Syntax

The zfs set command is used to share and publish a ZFS file system over the NFS or SMB protocols. Or, you can set the share.nfs or share.smb property when the file system is created.

For example, the tank/sales file system is created and shared. The default share permissions are read-write for everyone. The descendent tank/sales/logs file system is also shared automatically because the share.nfs property is inherited to descendent file systems and the tank/sales/log file system is set to read-only access.

$ zfs create -o share.nfs=on tank/sales
$ zfs create -o share.nfs.ro=\* tank/sales/logs
$ zfs get -r share.nfs tank/sales
NAME             PROPERTY   VALUE  SOURCE
tank/sales       share.nfs  on     local
tank/sales%      share.nfs  on     inherited from tank/sales
tank/sales/log   share.nfs  on     inherited from tank/sales
tank/sales/log%  share.nfs  on     inherited from tank/sales

You can provide root access to a specific system for a shared file system as follows:

$ zfs set share.nfs=on tank/home/data
$ zfs set share.nfs.sec.default.root=neo.daleks.com tank/home/data