[Borgbackup] Crontab

Alberto Luaces borgbackup at aluaces.fastmail.com
Thu Jun 1 09:32:26 EDT 2023


Ralf Fechner via Borgbackup <borgbackup at python.org> writes:

>> Am 01.06.2023 um 13:53 schrieb Alberto Luaces <borgbackup at aluaces.fastmail.com>:
>> 
>> Ralf Fechner via Borgbackup <borgbackup at python.org> writes:
>> 
>>> Now I have created a new SSH key to access the server. I no longer have this Key in the .ssh directory, but I load this key into the ssh agend using KeepassXC.
>> 
>> You can run «ssh-add -L» from your cron script and inspect the logs.
>> 
>> My bet is that the environment variables the ssh agent exports are not
>> available when running the script through cron, thus ssh cannot reach
>> the key.
>
> Ok, I have done that. Then comes the message:
>
> Could not open a connection to your authentication agent.
>
> This means that Crontab can not access the agent. Is it possible to change this? If yes how?
>

You can copy the content of your $SSH_AUTH_SOCK environment variable in
the cron job, but that is likely to change from time to time, so it is
not a long-term solution.

The usual procedure is to use a passwordless key, but restricting it to
just running borg on the remote side, as shown in
https://borgbackup.readthedocs.io/en/stable/deployment/pull-backup.html#ssh-agent


More information about the Borgbackup mailing list