This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
linux:sudo [2022/09/27 11:55] manu [sudo -i vs sudo su] |
linux:sudo [2025/02/25 13:27] (current) manu [sudo howto] |
||
|---|---|---|---|
| Line 20: | Line 20: | ||
| # sudo -u bin -g operator /bin/ls /whatever/directory | # sudo -u bin -g operator /bin/ls /whatever/directory | ||
| - | <cli> | + | <cli prompt='>'> |
| [root@aix001]/etc/sudoers.d> cat zabbix | [root@aix001]/etc/sudoers.d> cat zabbix | ||
| %AIXUSERS ALL=(root) NOPASSWD: /usr/bin/vi /etc/zabbix/* | %AIXUSERS ALL=(root) NOPASSWD: /usr/bin/vi /etc/zabbix/* | ||
| Line 31: | Line 31: | ||
| [myaixuser01@aix001]/home/myaixuser01> sudo /etc/rc.d/init.d/zabbix-agent start | [myaixuser01@aix001]/home/myaixuser01> sudo /etc/rc.d/init.d/zabbix-agent start | ||
| Zabbix agent started | Zabbix agent started | ||
| + | </cli> | ||
| + | |||
| + | Change sudo default timeout (5 min): | ||
| + | <cli prompt='>'> | ||
| + | root@nimprod /root> sudo -V | grep -i time | ||
| + | Lecture user the first time they run sudo | ||
| + | Authentication timestamp timeout: 120.0 minutes | ||
| + | Password prompt timeout: 5.0 minutes | ||
| + | Path to authentication timestamp dir: /var/run/sudo/ts | ||
| + | Type of authentication timestamp record: tty | ||
| + | Sudo log server timeout in seconds: 30 | ||
| + | |||
| + | root@nimprod /root> grep -i time /etc/sudoers | ||
| + | Defaults timestamp_timeout=120 | ||
| </cli> | </cli> | ||
| Line 68: | Line 82: | ||
| This command is best used when the user wants to switch over to root but keep the same shell environment. | This command is best used when the user wants to switch over to root but keep the same shell environment. | ||
| + | |||
| + | ===== Run command su/sudo with nologin ===== | ||
| + | |||
| + | As user with nologin shell can't be reached with "su - user", but you can use instead the command | ||
| + | runuser | ||
| + | |||
| + | |||