Restic - backup fail (Could not run script: /etc/yunohost/hooks.d/backup_method/05-restic_app)

Apparently a connection error :

subprocess ssh: Host key verification failed.
Fatal: unable to open repository at sftp://user@targetserver.noho.st:9999//home/user/restic/auto_zerobin: unable to start the sftp session, error: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF

Tried a regular connection with this user :

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0660 for '/home/user/.ssh/id_ed25519' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/user/.ssh/id_ed25519": bad permissions

I did a chmod 600 on this file, i‘ll retry the backup.

Well, in my case, it seems to chmod 600 the private key solved the issue. Log indicate successful backups.

1 Like

Mh, in my case it’s probably caused by an assumption that SFTP is used.
There are these log lines

2026-02-20 14:31:59,399: DEBUG - + export RESTIC_PASSWORD
2026-02-20 14:31:59,399: DEBUG - + export RESTIC_REPOSITORY=b2:xxxxxxxxxxx/auto_wordpress
2026-02-20 14:31:59,399: DEBUG - + RESTIC_REPOSITORY=b2:xxxxxxxxxxx/auto_wordpress

where it’s clear that it’s meant to specify a path, but that’s not how restic backups on B2 (or S3, I think) work. If I try to run restic manually:

B2_ACCOUNT_ID=xxxxxxxxxxx B2_ACCOUNT_KEY=xxxxxxxxxxx /var/www/restic/restic stats -r "b2:xxxxxxxxxxx/auto_wordpress"
Fatal: parsing repository location failed: bucket name contains invalid characters, allowed are: a-z, 0-9, dash (-)

Feel free to move this to a separate topic btw.

According to Restic documentation, something like b2:bucketname:path/to/repo should work. Try to add a colon at the end of your repository location so that restic_ynh can append /auto_wordpress to it.

1 Like

That colon fixed the problem, thank you for reading the restic documentation more carefully than me :grimacing: (now I have some issue with backing up specific apps, but I will open a separate topic)

1 Like