2

I feel like I am missing something very simple / basic here, but I wasn't able to figure out how to mount a ZFS dataset such that the mount point (root directory) has a given uid/gid ownership? Something along the lines of:

root# zfs mount -o uid=[uid] -o gid=[gid] ....
1
  • 2
    I doubt that uid and gid are valid mount options for ZFS and you rather have to chown the mounted filesystem root. – Thomas Mar 9 '19 at 17:17
5

The ownership of the (root) directory is a property of that directory. If you want to change it, you have todo this once the filesystem is mounted. This has nothing todo with zfs. Only filesystems drivers for filesystems like FAT or VFAT which do not have file ownership as a built-in property allow you to set the user/group at mount-time.

So to answer your question

# zfs mount mypool/myzfs
# chown myuser:mygroup /mypool/myzfs

is all it takes.

3
  • 1
    and even if I unmount and remount the dataset, the ownership of /mypool/myzfs will be maintained? – Saurabh Nanda Mar 11 '19 at 6:56
  • sure ... as I said, the ownership is part of the filesystem, not part of the mountpoint – Tobi Oetiker Mar 11 '19 at 10:34
  • 1
    yes, confirmed this. Didn't realise this was so simple! – Saurabh Nanda Mar 11 '19 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.