From 2a5562d1a9e2328b68ed2cfba9e4f04e96292c36 Mon Sep 17 00:00:00 2001 From: Fuxino Date: Thu, 8 Oct 2026 20:17:29 +0200 Subject: [PATCH] Pass the SSH key file to rsync also when not running as root The key file given with --keyfile was only passed to rsync's ssh command when running as root, so as a normal user rsync ignored it and fell back to the default keys or the agent. --- simple_backup/simple_backup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index 15fec5d..603ca4a 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -559,9 +559,7 @@ class Backup: rsync = f'/usr/bin/rsync {self.options} --link-dest="{self._last_backup}" --exclude-from=' +\ f'{self._exclude_path} --files-from={self._inputs_path} / "{self._server}{self._output_dir}"' - euid = os.geteuid() - - if euid == 0 and self.ssh_keyfile is not None: + if self.ssh_keyfile is not None: rsync = f'{rsync} -e \'ssh -i {self.ssh_keyfile} -o StrictHostKeyChecking=no\'' elif self._password_auth and which('sshpass'): rsync = f'{rsync} -e \'sshpass -e ssh -l {self.ssh_user} -o StrictHostKeyChecking=no\''