This is an old revision of the document!
Use visudo command to update the file /etc/sudoers, do not manual edit
Which password will be asked ? default is target user password, and for group wheel, source user password:
Defaults targetpw Defaults:%wheel !targetpw
In the following sudo entry:
<user> <host>=(<taget_user>[:<target_group>]) <cmd>
Example:
alan ALL = (root, bin : operator, system) /bin/ls, /bin/kill %adm ALL=(ALL) NOPASSWD: ALL
Here, alan is allowed to run the two commands /bin/ls and /bin/kill as root (or bin), possibly with additional operator or system groups privileges.
So alan may choose to run ls as the bin user and with operator's group privileges like this (additional operator groups privileges):
# sudo -u bin -g operator /bin/ls /whatever/directory
[root@aix001]/etc/sudoers.d> cat zabbix %AIXUSERS ALL=(root) NOPASSWD: /usr/bin/vi /etc/zabbix/* %AIXUSERS ALL=(root) NOPASSWD: /etc/rc.d/init.d/zabbix-agent %testaixgrp ALL=(root) NOPASSWD: /usr/bin/vi /etc/zabbix/* %testaixgrp ALL=(root) NOPASSWD: /etc/rc.d/init.d/zabbix-agent [root@aix001]/etc/sudoers.d> su - myaixuser01 [myaixuser01@aix001]/home/myaixuser01> sudo vi /etc/zabbix/zabbix_agentd.d/toto [myaixuser01@aix001]/home/myaixuser01> sudo /etc/rc.d/init.d/zabbix-agent start Zabbix agent started
Using sudo -i is virtually the same as the sudo su command with one exception: it does not directly interact with the root user.