Skip to content

Quickly Grant User Access to Cluster Commands

Introduction

We often need users to have access to specific commands without being root, and for cluster management, if you have dedicated administrators, it's quite useful. Here's a simple way to give them the necessary permissions...

Configuration

To give a user permissions to simply use cluster commands, here are the files to modify:

  • /etc/sudoers:
# Cmnd alias specification
Cmnd_Alias     CLUSTAT          = /usr/sbin/clustat
Cmnd_Alias     CLUSVCADM        = /usr/sbin/clusvcadm
Cmnd_Alias     MOUNT            = /bin/mount
Cmnd_Alias     UMOUNT           = /bin/umount

# Defaults specification

# User privilege specification
root            ALL=(ALL) ALL
my_user          ALL=NOPASSWD:CLUSTAT,NOPASSWD:CLUSVCADM,NOPASSWD:MOUNT,NOPASSWD:UMOUNT
  • ~/.bashrc (for the user)
1
2
3
4
5
# User specific aliases and functions
alias clustat='sudo /usr/sbin/clustat'
alias clusvcadm='sudo /usr/sbin/clusvcadm'
alias mount='sudo /bin/mount'
alias umount='sudo /bin/umount'

Usage

With my user account, I can simply run the commands and they will be executed as root:

$ clustat