Ad Widget

Collapse

Zabbix Agent not Running as Root

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • finnshelby
    Banned
    • Dec 2019
    • 1

    #1

    Zabbix Agent not Running as Root

    Hey everyone,

    I'm in charge of setting up a POC for Zabbix at my firm, and while things are mostly going well I'm hitting a brick wall taht makes 0 sense to me. In my environment, in order to accomplish the checks that we require the Zabbix agent will have to run as root (no, sudo will sadly not work in this instance). I've set the 'AllowRoot' flag in the config file, but it refuses to run as root. It continues to run as the 'zabbix' user. What I think is pertinent data below, but if more is needed let me know and I'll see what I can provide:

    Zabbix Server version: zabbix_server (Zabbix) 4.4.3; Revision 6cad6f888e 27 November 2019, compilation time: Nov 27 2019 08:51:06
    Zabbix Agent version: zabbix_agentd (daemon) (Zabbix) 4.4.3; Revision 6cad6f888e 27 November 2019, compilation time: Nov 27 2019 03:49:42
    Zabbix Server Host OS: CentOS Linux release 7.7.1908 (Core)
    Zabbix Agent Host OS: CentOS release 6.8 (Final)/CentOS release 6.9 (Final)
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    Please check User setting in zabbix_agentd.conf.

    Comment

    • thrubovc
      Junior Member
      • Dec 2019
      • 1

      #3
      I have been running zabbix for a couple years now, and after an agent update (from 4.0.11) to 4.0.15, my zabbix agent stopped starting under the root user. My config was correct (in the /etc/zabbix/zabbixagentd.conf I only specify AllowRoot=1, the User parameter stays commented out). After a while of searching it turned out that this will work as long as zabbix agent isn't specifically run under another user. I checked the service file for zabbix agent and lo and behold, I guess the installation must have put in 2 new lines with User=zabbix and Group=zabbix. I changed those to root and it started working again. Maybe this helps someone.

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        The change was made when upgrading from 4.0.14 to 4.0.15. Similar changes have been made in 4.4.1 to 4.4.2. In RHEL 7, it is described in the following service file.

        /usr/lib/systemd/system/zabbix-agent.service

        In RHEL 6, since the service is started with initd, the following files should be changed.

        /etc/init.d/zabbix-agent

        The changes are as follows.

        old:
        daemon $exec -c $conf
        new:
        daemon --user=zabbix $exec -c $conf

        It is explicitly specified to start as zabbix user, so if you start as another user, you will need to revert this configuration change.

        Comment

        Working...