# The remote backup copy fails with "Permission denied (publickey)"

UrbeStack sysadmin note about OpenSSH. Last updated 30 Nov 2026.

Copying backups to a remote server fails with `Permission denied (publickey)`. Add UrbeStack's missing public key to the remote user's `~/.ssh/authorized_keys` to fix the OpenSSH login.

## Symptoms

The remote backup test fails.

```
urbestack-backup-remote-test
```
```output
{"error":"The remote did not answer as expected: backup@203.0.113.20: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). The remote refused the panel's key: put the public key shown on the Backups page in ~/.ssh/authorized_keys of backup on 203.0.113.20.","ok":false,"status":502}
```

## Cause

UrbeStack logs in to the remote server over OpenSSH with its own key pair, which it creates once. The remote user's `~/.ssh/authorized_keys` must contain that pair's public key.

## Resolution

Show UrbeStack's public key and its fingerprint.

```
urbestack-backup-remote-key
```

On the remote server, add the `public_key` line to the remote user's `~/.ssh/authorized_keys`. Set the file mode to `0600` and the mode of `~/.ssh` to `0700`.

Run the test again.

```
urbestack-backup-remote-test
```

The test returns `"ok":true` and the free space at the remote path. It also records the remote server's host key for subsequent nightly copies.

If the problem persists after you follow this note, you can [open a support ticket](https://support.urbestack.com/new?type=support). Including the output of the commands you ran helps support diagnose the problem.
