I have some sudo rules setup for many (virtual) servers (mostly debian) to be used by zabbix scripts:
zabbix ALL=NOPASSWD: /etc/init.d/exim4 restart
The zabbix-agent and sudo configuration file (
/etc/sudoers.d/zabbix-agent) is distributed via ansible, and is the same for all servers.
However, on some servers, sudo asks for a password. On others, it does not. It is the same whether I run the command using zabbix, or locally:
# sudo -u zabbix sudo /etc/init.d/exim4 restart
Sometimes, it works and sometimes it asks for the password.
I looked into it, and the obvious answer that there is a different rule for the zabbix user in the sudo config is not true.
What other factors could result in the system asking for a password anyway?