This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
aix:aix_sudo [2021/12/06 17:28] manu [SUDO options] |
aix:aix_sudo [2023/08/17 01:02] (current) manu |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== SUDO options ====== | ====== SUDO options ====== | ||
| + | |||
| + | Use **sudo -l** to list your privileges | ||
| + | |||
| + | Use visudo instead of vi to edit a sudoers file | ||
| + | # visudo -f /etc/sudoers.d/oracle_priv | ||
| + | | ||
| + | Check syntax on a file: | ||
| + | <cli prompt='#'> | ||
| + | root@SERVER1:/ # visudo -cf /etc/sudoers | ||
| + | >>> sudoers file: syntax error, line 95 <<< | ||
| + | parse error in /etc/sudoers near line 95 | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='#'> | ||
| + | root@SERVER2:/ # visudo -cf /etc/sudoers | ||
| + | /etc/sudoers: parsed OK | ||
| + | /etc/sudoers.d/generic: parsed OK | ||
| + | /etc/sudoers.d/hosts-system: parsed OK | ||
| + | </cli> | ||
| If you want to use LDAP integrating with sudo, install sudo_ids from RPM package, add also the option into /etc/netsvc.conf | If you want to use LDAP integrating with sudo, install sudo_ids from RPM package, add also the option into /etc/netsvc.conf | ||
| Line 247: | Line 266: | ||
| further configuration | further configuration | ||
| - | This configuration is a basic one. It’s better to modify the configuration file /etc/security/ldap/ldap.cfg to better match your environment. | + | This configuration is a basic one. It’s better to modify the configuration file **/etc/security/ldap/ldap.cfg** to better match your environment. |
| Here an example of a more complex configuration: | Here an example of a more complex configuration: | ||
| Line 305: | Line 324: | ||
| sudo configuration | sudo configuration | ||
| - | Since a few months, IBM provides a sudo package with IBM Directory Server ldap + ssl support. The package is named sudo_ids. The minimum version is 1.8.20. | + | Since a few months, IBM provides a sudo package with IBM Directory Server ldap + ssl support. The package is named **sudo_ids**. The minimum version is 1.8.20. |
| If you installed yum on AIX(highly recommended), the installation is really easy: | If you installed yum on AIX(highly recommended), the installation is really easy: | ||
| Line 345: | Line 364: | ||
| You can also check if the sudo binary were built with ldap support by running this command: | You can also check if the sudo binary were built with ldap support by running this command: | ||
| - | <cli> | + | <cli prompt='#'> |
| # sudo -V|grep ldap | # sudo -V|grep ldap | ||
| Configure options: --prefix=/opt/freeware --sbindir=/opt/freeware/sbin --mandir=/opt/freeware/share/man --docdir=/opt/freeware/share/doc/sudo_ids-1.8.20p2 --with-logging=syslog --with-aixauth --with-logfac=auth --without-pam --with-env-editor --with-ignore-dot --with-tty-tickets --with-ldap --with-ldap-conf-file=/etc/sudo-ldap.conf | Configure options: --prefix=/opt/freeware --sbindir=/opt/freeware/sbin --mandir=/opt/freeware/share/man --docdir=/opt/freeware/share/doc/sudo_ids-1.8.20p2 --with-logging=syslog --with-aixauth --with-logfac=auth --without-pam --with-env-editor --with-ignore-dot --with-tty-tickets --with-ldap --with-ldap-conf-file=/etc/sudo-ldap.conf | ||
| Line 352: | Line 371: | ||
| </cli> | </cli> | ||
| - | It will also give you the place of the ldap configuration file for sudo. Here it’s /etc/sudo-ldap.conf. | + | It will also give you the place of the ldap configuration file for sudo. Here it’s **/etc/sudo-ldap.conf**. |
| This configuration file is pretty simple to understand: | This configuration file is pretty simple to understand: | ||
| Line 375: | Line 394: | ||
| In production, it’s better to store the bind dn password in the /etc/ldap.secret file. | In production, it’s better to store the bind dn password in the /etc/ldap.secret file. | ||
| - | It’s also mandatory to modify the /etc/netsvc.conf file to allow sudo to use LDAP. | + | It’s also mandatory to modify the **/etc/netsvc.conf** file to allow sudo to use LDAP. |
| <cli> | <cli> | ||
| sudoers = files, ldap | sudoers = files, ldap | ||
| </cli> | </cli> | ||
| + | Example of syntax for /etc/sudoers file | ||
| + | %wheel ALL=(ALL) NOPASSWD: ALL | ||
| + | user01 ALL=NOPASSWD:/usr/sbin/lsdev | ||
| + | | ||