Allowing ZFS Snapshots

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.

Comments:

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).

Posted by patrick giagnocavo on February 03, 2009 at 07:12 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20
21
22
23
24
25
26
27
28
29
30
   
       
Today