X

News, tips, partners, and perspectives for the Oracle Solaris operating system

Allowing ZFS Snapshots

Guest Author
I find myself working with ZFS snapshots quite a bit, and as a convenience, I'd prefer if I didn't have to prefix the commands with pfexec. For example:



pfexec zfs rollback rpool/vbox@clean

Fortunately, it is possible to delegate the permission to run ZFS commands to my user account using zfs allow. For example:

pfexec zfs allow bleonard snapshot,rollback,mount rpool/vbox

Note, the ability to 'mount' is required in order to create and rollback snapshots. See the zfs man page for details.

To see the permissions assigned to a file system:

bleonard@opensolaris:~$ zfs allow rpool/vbox
-------------------------------------------------------------
Local+Descendent permissions on (rpool/vbox)

user bleonard mount,rollback,snapshot
-------------------------------------------------------------

Now rollbacks are a bit easier:

zfs rollback rpool/vbox@clean

You can delegate any of the zfs commands, including allow. For more details see Delegating ZFS Permissions.

Join the discussion

Comments ( 1 )
  • patrick giagnocavo Tuesday, February 3, 2009

    That is the "right" way to do it.

    However you could also use the "alias" builtin command in bash to alias "zfs" to "pfexec zfs".

    e.g. put the line:

    alias zfs="pfexec zfs"

    in your .profile or .bashrc ; then logout and login (or start a new terminal window if in a GUI).


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.