Page 1 of 1

Having trouble with delegate!

PostPosted: Sun Dec 17, 2017 8:34 pm
by Sharko
So, I've been meaning to get zfs-auto-snapshot up and running for quite a while, and today I took (another) run at it. I'm using the app LaunchControl to build a plist file as a User Agent, but I'm getting errors when it tries to run:

Code: Select all
/Users/adminkurt/Documents/zfstools-master/lib/zfstools/dataset.rb:29:in `popen': No such file or directory - zfs (Errno::ENOENT)
   from /Users/adminkurt/Documents/zfstools-master/lib/zfstools/dataset.rb:29:in `list'
   from /Users/adminkurt/Documents/zfstools-master/lib/zfstools.rb:132:in `find_eligible_datasets'
   from /Users/adminkurt/Documents/zfstools-master/bin/zfs-auto-snapshot:65:in `<main>'

Here is the plist file 'com.zfstools.zfs-auto-snapshot.frequent.plist':

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Disabled</key>
   <true/>
   <key>Label</key>
   <string>com.zfstools.zfs-auto-snapshot.frequent</string>
   <key>Nice</key>
   <integer>1</integer>
   <key>ProgramArguments</key>
   <array>
      <string>/Users/adminkurt/Documents/zfstools-master/bin/zfs-auto-snapshot</string>
      <string>frequent</string>
      <string>4</string>
   </array>
   <key>StandardErrorPath</key>
   <string>/Users/adminkurt/Documents/zfstools-master/logs/zfs-auto-snapshot.frequent.err</string>
   <key>StandardOutPath</key>
   <string>/Users/adminkurt/Documents/zfstools-master/logs/zfs-auto-snapshot.frequent.out</string>
   <key>StartCalendarInterval</key>
   <array>
      <dict>
         <key>Minute</key>
         <integer>15</integer>
      </dict>
      <dict>
         <key>Minute</key>
         <integer>30</integer>
      </dict>
      <dict>
         <key>Minute</key>
         <integer>45</integer>
      </dict>
   </array>
</dict>
</plist>


I'm guessing that it is trying to run as my admin user 'adminkurt', since the plist is stored under /Users/adminkurt/Library/LaunchAgents, not in the system location. I'd like to avoid running it as root, so I thought I would use the ZFS delegation feature:

Code: Select all
sudo zfs allow -u adminkurt list,status,snapshot,get,destroy tank

but I get this error message:

Code: Select all
cannot set permissions on 'tank': operation not applicable to datasets of this type

I tried changing the command to

Code: Select all
sudo zfs allow -u adminkurt list,status,snapshot,get,destroy tank/HOME

but then it still gives

Code: Select all
cannot set permissions on 'tank/HOME': operation not applicable to datasets of this type


Any suggestions for how to accomplish my goal? Thanks,

Kurt

Re: Having trouble with delegate!

PostPosted: Mon Dec 18, 2017 12:27 am
by lundman
Oh ah, I'm not sure we have ported "zfs allow" yet, which sucks.. it has not been very high priority. You can accomplish the same thing with additions to sudoers file instead.

Eventually though, it'd be nice to have that part working as well.

Re: Having trouble with delegate!

PostPosted: Mon Dec 18, 2017 8:13 am
by Sharko
Hi lundman, thanks for the quick reply! I'll have a go at using the sudoers file.

Kurt