56 words
1 minute
Disabling SSH Login on the Nezha Monitoring Agent
2025-01-14

Background#

The Nezha monitoring agent ships with SSH login enabled by default. Sometimes you’ll want to turn that off — for instance, to keep attackers from getting in through it.

Disabling SSH Login on the Agent#

V0#

  1. Edit /etc/systemd/system/nezha-agent.service
    Terminal window
    nano /etc/systemd/system/nezha-agent.service
  2. Append --disable-command-execute to the ExecStart= line
  3. Restart the agent
    Terminal window
    systemctl daemon-reload
    systemctl restart nezha-agent

V1#

  1. Edit /opt/nezha/agent/config.yml
    Terminal window
    nano /opt/nezha/agent/config.yml
  2. Set disable_command_execute to true
  3. Restart the agent
    Terminal window
    systemctl restart nezha-agent
Disabling SSH Login on the Nezha Monitoring Agent
https://www.mihouo.com/en/posts/server/close-nezha-agent-ssh-login/
Author
Jia
Published at
2025-01-14
License
CC BY-NC-SA 4.0