]> git.proxmox.com Git - mirror_zfs.git/blobdiff - cmd/zfs/zfs_main.c
Add `zfs allow` and `zfs unallow` support
[mirror_zfs.git] / cmd / zfs / zfs_main.c
index 7525afcbfd6df6cb098b7b5e80ae54e10565199e..8bcff2dba7856fc3b383d72f29392d01dd439d60 100644 (file)
@@ -610,7 +610,12 @@ zfs_mount_and_share(libzfs_handle_t *hdl, const char *dataset, zfs_type_t type)
         */
        if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, type, B_FALSE) &&
            zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON) {
-               if (zfs_mount(zhp, NULL, 0) != 0) {
+               if (geteuid() != 0) {
+                       (void) fprintf(stderr, gettext("filesystem "
+                           "successfully created, but it may only be "
+                           "mounted by root\n"));
+                       ret = 1;
+               } else if (zfs_mount(zhp, NULL, 0) != 0) {
                        (void) fprintf(stderr, gettext("filesystem "
                            "successfully created, but not mounted\n"));
                        ret = 1;