ThisCalculator

Everyday

Change Hermes Agent Web Port: Step-by-Step Guide

Updated · Standard formula, shown below

Change Hermes Agent Web Port: Step-by-Step Guide

This guide shows you how to change the port that the Hermes agent web interface listens on. This is useful when the default port is already in use, or when you need to run multiple instances. You’ll edit a configuration file, restart the service, and verify the new port is active.

What You’ll Need

  • Access to the machine where Hermes agent is installed (local or SSH).
  • Administrative or sudo privileges to edit system files and restart services.
  • A text editor (e.g., nano, vim, or notepad).
  • The current Hermes agent configuration file location (typically /etc/hermes/agent.conf or ~/.hermes/agent.conf).

Step-by-Step

  1. Locate the configuration file. The default path is usually /etc/hermes/agent.conf on Linux, or %APPDATA%\Hermes\agent.conf on Windows. If you’re unsure, run hermes-agent --help or check the installation directory.
  2. Back up the current configuration. Before making changes, copy the file: cp /etc/hermes/agent.conf /etc/hermes/agent.conf.bak (adjust path as needed). This lets you revert if something goes wrong.
  3. Open the configuration file in a text editor. Use sudo nano /etc/hermes/agent.conf or your preferred editor.
  4. Find the web port setting. Look for a line like web_port = 8080 or port = 8080. It might be under a [web] or [server] section. If you don’t see it, search for “port” using your editor’s search function (Ctrl+W in nano).
  5. Change the port number. Replace the number with your desired port, e.g., web_port = 9090. Make sure the new port is not already in use by another service (check with netstat -tulpn | grep on Linux).
  6. Save and close the file. In nano, press Ctrl+O, Enter, then Ctrl+X.
  7. Restart the Hermes agent service. Use the appropriate command for your system:
    • Systemd (most Linux): sudo systemctl restart hermes-agent
    • SysVinit: sudo service hermes-agent restart
    • Windows: Open Services (Win+R, type services.msc), find Hermes Agent, right-click and select Restart.
  8. Verify the new port is active. Check the service status: sudo systemctl status hermes-agent (should show “active (running)”). Then test the web interface by opening a browser to http://localhost:9090 (replace with your new port). You can also use curl http://localhost:9090 to see if it responds.
  9. Update any firewall rules (if applicable). If you have a firewall (e.g., ufw or firewalld), allow the new port: sudo ufw allow 9090 or sudo firewall-cmd --add-port=9090/tcp --permanent (then reload).

Common Mistakes

  • Editing the wrong file. There might be multiple config files (e.g., a global one and a user-specific one). Make sure you’re editing the one the agent actually reads.
  • Using a port below 1024 without root. Ports 1-1023 require root privileges. If you choose one, the agent might fail to start unless run as root.
  • Port already in use. If another service uses the port, the agent will fail to bind. Always check before changing.
  • Forgetting to restart. The change won’t take effect until the agent is restarted.
  • Syntax errors in the config. An extra space or missing equals sign can cause the agent to ignore the setting or crash. Keep the format exactly as it was.

Tips

  • Choose a port above 1024 (e.g., 8080, 9090, 3000) to avoid permission issues.
  • Use a port that is not commonly used by other applications (e.g., 8080 is often used by web servers, so consider 8081 or 8443).
  • If you’re running multiple instances, each needs its own port. You can also set a different bind address (e.g., bind = 127.0.0.1 for local only).
  • After changing the port, update any bookmarks or scripts that reference the old port.
  • Check the agent’s log file (usually in /var/log/hermes/ or ~/.hermes/logs/) for any errors after restart.

Troubleshooting

If the agent doesn’t start or the web interface isn’t accessible after the change:

  • Check the service status. Run sudo systemctl status hermes-agent. If it shows “failed”, look at the log with journalctl -u hermes-agent (or the log file). Common errors include “Address already in use” or “Permission denied”.
  • Verify the config file is being read. Run hermes-agent --print-config (if available) to see the effective settings. If it shows the old port, the agent might be using a different file.
  • Test with a different port. If the issue persists, try another port to rule out a conflict.
  • Check firewall and SELinux. On CentOS/RHEL, SELinux might block the new port. Use sudo semanage port -a -t http_port_t -p tcp 9090 if needed.
  • Restart the machine. As a last resort, a full reboot can clear any lingering process holding the port.

Frequently Asked Questions

What is the default Hermes agent web port?

The default is often 8080, but it can vary by installation. Check the config file to confirm.

Can I change the port to 80?

Yes, but you need to run the agent as root or use a reverse proxy like Nginx to forward port 80 to your chosen port.

Do I need to change the firewall if I change the port?

Yes, if your firewall was configured to allow the old port, you must allow the new one. Otherwise, external access will be blocked.

How do I find the current port if I forgot?

Check the config file, or run netstat -tulpn | grep hermes to see which port the process is listening on.

Will changing the port affect my existing sessions?

Yes, any active web sessions will be disconnected. You’ll need to reconnect using the new port.

Can I run multiple Hermes agents on different ports?

Yes, as long as each has its own config file and port. You can start them with hermes-agent -c /path/to/config.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.