How to run Zabbix-agent as root

I once added user options to the Zabbix agent configuration and they needed to access files that could only have root permissions, so I had to run Zabbix-agent as root.

I used the Ubuntu Server operating system, so I opened the configuration file below in a text editor:

sudo nano /lib/systemd/system/zabbix-agent.service

And changed user and group to “root” instead of “zabbix”:

[Service]
User=root
Group=root

Also in the file /etc/zabbix/zabbix_agentd.conf specified:

AllowRoot=1

And applied the changes:

sudo systemctl daemon-reload
sudo service zabbix-agent restart

After that, I made sure that Zabbix-agent is running as root user:

ps ux | grep zabbix_agentd

I note that the AllowRoot and User options in the Zabbix-agent configuration will not give full root user privileges, so I had to start Zabbix-agent as root as I described above.

After that, all the data elements I needed, which I created, began to work successfully.

See also my other articles about Zabbix

Leave a comment

Leave a Reply