How to configure the sudoers file

Summary: UNIX sudoers file configuration

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

1) Create an account that you will use to discover the server.

2) Set the password for the <account name>, set to non-expire and not to prompt to change password for first login.

3) Add the following Path variables in /home/<account name>/.profile at the end of the file and save the .profile:
 

PATH=$PATH:/usr/bin:/usr/sbin:/sbin:/bin:/usr/local/bin 


export PATH

4) Update sudo as <account name> requires ODMDIR. The below line must be present (Note: This is for AIX ONLY)

Defaults env_keep += "ODMDIR


5) Add the following at the end of the sudoers file and save it.

<account name> ALL=(ALL) NOPASSWD:
/usr/local/ibm/bin/inq_AIX,/usr/sbin/sar,/usr/sbin/swap,/usr/sbin/powermt,/usr/bin/i
ostat,/sur/sbin/iostat,/bin/iostat,/bin/df,/usr/local/sun/bin/inq_SUN,/usr/sbin/lvs,/usr/sbin/vgs,/sbin/pvs,/u
sr/sbin/pvs,/sbin/sar,/usr/bin/sar,/sbin/dmidecode,/usr/bin/dmidecode,/usr/sbin/dmidecode,/sbin/vxdisk,/usr/bi
n/vxdisk,/usr/sbin/vxdisk,/sbin/lvm,/sbin/lvs/display,/sbin/vgs,/sbin/multipath,/usr/sbin/lsvg
<account name> ALL=(ALL) ALL
<account name> ALL=(ALL) NOPASSWD: ALL

6) Log in using the <account name> then test the sudo comand:

$ sudo -l
User <account name> may run the following commands on this host:
(ALL) NOPASSWD: /usr/local/ibm/bin/inq_AIX
(ALL) NOPASSWD: /usr/sbin/sar
(ALL) NOPASSWD: /usr/sbin/swap
(ALL) NOPASSWD: /usr/sbin/powermt
(ALL) NOPASSWD: /usr/bin/iostat
(ALL) NOPASSWD: /sur/sbin/iostat
(ALL) NOPASSWD: /bin/iostat
(ALL) NOPASSWD: /bin/df
(ALL) NOPASSWD: /usr/local/sun/bin/inq_SUN
(ALL) NOPASSWD: /usr/sbin/lvs
(ALL) NOPASSWD: /usr/sbin/vgs
(ALL) NOPASSWD: /sbin/pvs
(ALL) NOPASSWD: /usr/sbin/pvs
(ALL) NOPASSWD: /sbin/sar
(ALL) NOPASSWD: /usr/bin/sar
(ALL) NOPASSWD: /sbin/dmidecode
(ALL) NOPASSWD: /usr/bin/dmidecode
(ALL) NOPASSWD: /usr/sbin/dmidecode
(ALL) NOPASSWD: /sbin/vxdisk
(ALL) NOPASSWD: /usr/bin/vxdisk
(ALL) NOPASSWD: /usr/sbin/vxdisk
(ALL) NOPASSWD: /sbin/lvm
(ALL) NOPASSWD: /sbin/lvs/display
(ALL) NOPASSWD: /sbin/vgs
(ALL) NOPASSWD: /sbin/multipath
(ALL) NOPASSWD: /usr/sbin/lsvg
(ALL) ALL
(ALL) NOPASSWD: ALL

7) Manually test the account name access:

ssh <account name>@<hostname> "sudo swap -l"

Example of the required commands for the different UNIX OS:
The Absolute Path to the Following commands is required in the sudoers file
AIX:

sar, inq, powermt, vxdisk, swap, kdb (kdb is only for VIO Clients) 

Linux:

sar, inq, powermt, vxdisk, dmidecode, lvdisplay, pvs, vgs, multipath

HPUX:
sar, inq, powermt, vxdisk, /opt/sfm/bin/CIMUtil (CIMUtil is allowed only in ViPR SRM 3.5.1 or higher)

Solaris:
sar, inq, powermt, vxdisk, mpstat

     Include the Absolute path of sudo command in the environment variable $PATH for the sudo user.
     Include the Absolute paths of OS commands in the environment variable $PATH for sudo user.

By default, the sudoers file is available in /etc or /opt/sfw/etc/ or /usr/local/etc/sudoers
Ensure the Absolute path to the packages are provided in sudoers file.

Add the following line to the defaults section of the sudoers file:

Defaults !requiretty #for all users
OR
Defaults : SRMADMIN !requiretty #for a specific user

Affected Products

Software
Article Properties
Article Number: 000019248
Article Type: How To
Last Modified: 29 Jul 2025
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.