Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: why does ZoL require root for read-only operations? #4468

Closed
mdlayher opened this issue Mar 28, 2016 · 4 comments
Closed

Question: why does ZoL require root for read-only operations? #4468

mdlayher opened this issue Mar 28, 2016 · 4 comments

Comments

@mdlayher
Copy link

Related to an ongoing discussion in prometheus/node_exporter#213.

Apparently, on FreeBSD, you are able to retrieve these kinds of metrics without superuser privileges. For example, commands like zfs list, zfs get, etc. shouldn't really require running as root.

Is there any way around this, and if not, is there a reason that ZoL works this way? Thanks in advance.

@rlaager
Copy link
Member

rlaager commented Mar 28, 2016

#434

The best work-around at this point is to create an /etc/sudoers.d/zfs file (permissioned 0440) with these contents and then use sudo:

Cmnd_Alias C_ZFS =       \
  /sbin/zfs "",          \
  /sbin/zfs help *,      \
  /sbin/zfs get,         \
  /sbin/zfs get *,       \
  /sbin/zfs list,        \
  /sbin/zfs list *,      \
  /sbin/zpool "",        \
  /sbin/zpool help *,    \
  /sbin/zpool iostat,    \
  /sbin/zpool iostat *,  \
  /sbin/zpool list,      \
  /sbin/zpool list *,    \
  /sbin/zpool status,    \
  /sbin/zpool status *,  \
  /sbin/zpool upgrade,   \
  /sbin/zpool upgrade -v

# Allow read-only ZFS commands to be called through sudo without a password.
ALL ALL = (root) NOPASSWD: C_ZFS

@DeHackEd
Copy link
Contributor

"Questions" belong on the mailing list.

@behlendorf
Copy link
Contributor

@mdlayher at the moment you'll want to use sudo. Slightly longer term we do want to update the code so that certain commands don't require root.

@mdlayher
Copy link
Author

@behlendorf thanks for the info, and apologies, was not aware of the mailing list! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants