You add a freshly installed agent to the R1Soft Server Backup Manager (SBM), the server shows up fine, and the first backup dies within a second. The task log reads:
Connected to agent 203.0.113.20 at port 1167 successfully
Authenticating with agent 203.0.113.20 at port 1167 failed: Agent's public key matches stored public key, but agent rejected server's public key
Task Finished
The TCP connection works, so this is not a firewall problem. It is a trust problem, and it only runs one way: the SBM trusts the agent, but the agent does not trust the SBM. The fix takes under a minute on the agent.
What the error actually means
R1Soft authenticates in both directions. When you add a server, the SBM records the agent's public key — that is the "agent's public key matches stored public key" half, and it passed. The agent, in turn, only accepts managers whose public key it holds locally. On Linux those keys live as files under /usr/sbin/r1soft/conf/server.allow/, one per manager.
Adding a server in the SBM web UI does not push the manager's key to the agent. Something on the agent has to fetch it. If that step was skipped or failed during install, you get exactly this error.
Common ways to end up here:
- The install skipped
--get-key. Scripted or templated installs often run the package install and stop, especially on OpenVZ 7 and other hypervisor nodes where the agent was installed by hand. --get-keyfailed silently. The agent could not reach the SBM's web port at install time, so no key file was written.- The SBM was rebuilt or moved. A reinstalled manager has a new key pair, and a manager on a new IP or hostname no longer matches the stored file. See rebuilding the SBM after a disaster for the full list of things that change.
- A second SBM was added. Each manager needs its own key on the agent. Replication targets and failover SBMs are easy to forget.
Fix: fetch the manager key on the agent
1. Check which keys the agent holds
serverbackup-setup --list-keys
If the SBM you are backing up from is not listed, that is your problem. If it is listed under an old IP or hostname, remove the stale entry first:
serverbackup-setup --remove-key 198.51.100.10
2. Pull the key from the SBM
Point --get-key at the SBM's web URL — the same address and port you use for the web UI. HTTPS URLs are accepted:
serverbackup-setup --get-key https://sbm.example.com:8443
This is the one time the agent calls the manager rather than the other way round. The agent needs outbound access to the SBM's web port; the usual R1Soft firewall rules only open TCP/1167 inbound to the agent, so a locked-down node may need a temporary egress rule.
Run --list-keys again and confirm the SBM now appears.
3. Retest from the SBM
In the SBM, open the server under Protected Machines and run Test Agent Connection, or start a manual backup. The task log should now show "Authenticated with agent" and move on to the disk safe stage.
If --get-key fails
--get-key downloads the key from the SBM's /public_info endpoint. A "connection refused" or "couldn't connect" error means the agent cannot reach that URL:
- Confirm the port. Many SBMs run the web UI on a non-default port such as 8443; a bare
https://sbm.example.comwill hit 443 and fail. - Test from the agent with
curl -kI https://sbm.example.com:8443/public_info. - Check outbound firewall rules on the agent and inbound rules on the SBM.
If the network cannot be opened, copy the key by hand. Copy the public key from the SBM's configuration page, then on the agent create a file named after the SBM's IP inside /usr/sbin/r1soft/conf/server.allow/ and paste the key in with no line breaks or trailing whitespace. Retest from the SBM.
Windows agents
Same error, same cause. On Windows, run the bundled setup tool against the SBM URL:
"C:\Program Files\Server backup Agent\bin\r1soft-setup.exe" -g https://sbm.example.com:8443
The Windows Server agent guide covers paths and service names for current agent versions.
What does 'agent rejected server's public key' mean in R1Soft?+
Why didn't the R1Soft manager send its key when I added the server?+
Where does the R1Soft Linux agent store manager keys?+
Do I need to re-run --get-key after moving or rebuilding the SBM?+
Which port does serverbackup-setup --get-key use?+
Next steps
- Check every port the SBM and agents need: R1Soft ports and firewall reference.
- Backing up OpenVZ 7 nodes: R1Soft for OpenVZ 7 ploop containers.
- Agent installed but the kernel module is missing: fix the hcpdriver module error.
- Adding nodes to your fleet: R1Soft license.