Panellicense

Fix R1Soft "agent rejected server's public key" backup error

R1Soft backups fail with "agent rejected server's public key" when the agent never received the Backup Manager's key. Fetch it with --get-key and retest.

R1All R1Soft articlesTroubleshooting5 min readUpdated 2026-11-18
r1softbackup-agentauthenticationserverbackup-setuptroubleshoot
schema: HowToschema: FAQPageschema: TechArticle

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-key failed 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.com will 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?+
The Backup Manager trusts the agent, but the agent does not hold the manager's public key. Run serverbackup-setup --get-key with the SBM's web URL on the agent, then retest the connection.
Why didn't the R1Soft manager send its key when I added the server?+
Adding a server in the SBM only stores the agent's key on the manager side. The agent must fetch the manager's key itself with serverbackup-setup --get-key, normally as part of the agent install.
Where does the R1Soft Linux agent store manager keys?+
In /usr/sbin/r1soft/conf/server.allow/, one file per Backup Manager. Use serverbackup-setup --list-keys to view them and --remove-key to delete a stale one rather than editing files by hand.
Do I need to re-run --get-key after moving or rebuilding the SBM?+
Yes. A rebuilt SBM has a new key pair and a moved SBM no longer matches the stored entry. Remove the old key and fetch the new one on every agent, ideally with a config-management loop.
Which port does serverbackup-setup --get-key use?+
Whatever port is in the URL you pass. It must be the SBM's web UI port, for example https://sbm.example.com:8443, and the agent needs outbound access to it.

Next steps

Switch in an afternoon

Switch from your current reseller — free.

We migrate active cPanel, Plesk, LiteSpeed and CloudLinux licenses from any reseller. We prorate the first month so you never pay twice, and your customers see zero downtime during the swap.