YunoHost-Apps / borgserver_ynh

Borg server package for YunoHost
https://www.borgbackup.org/
GNU Affero General Public License v3.0
8 stars 4 forks source link

user created by borgserver can't access their home directory #40

Open deckname opened 3 years ago

deckname commented 3 years ago

This is the important part from the log:

2021-05-31 04:07:45,882: DEBUG - + set +e
2021-05-31 04:07:45,882: DEBUG - + borg init -e repokey ssh://xxx@xxx:22/~/backup
2021-05-31 04:07:46,623: WARNING - Remote: Debian GNU/Linux
2021-05-31 04:07:46,702: WARNING - Remote: Permission denied, please try again.
2021-05-31 04:07:46,742: WARNING - Remote: Permission denied, please try again.
2021-05-31 04:07:46,786: WARNING - Connection closed by remote host. Is borg working on the server?

I also can't manually ssh into the user, even though the authorized_keys is set properly, it is a new user and both on borg client and server new install of the app.

If I su to the user on the borgserver it gives a permission error su: warning: cannot change directory to /home/xxx: Permission denied

Both running YunoHost 4.2.5.2 (stable).

deckname commented 3 years ago

I got it to work. What was needed:

sudo chown backupuser /home/backupuser on the borgserver machine so that the backupuser can access their home and

chmod 600 .ssh/id_borg_ed25519 chmod 600 .ssh/id_borg_ed25519.pub as root on the machine that you want to be backed up, without this the machine can't ssh into the other one.

deckname commented 3 years ago

So it did work, I even checked the backups if they had the expected data. It worked when started with sudo systemctl start borg and it worked when it was started automatically for the first time. Now it fails with this error:

2021-06-03 09:10:38,526: WARNING - Remote: Debian GNU/Linux 10
2021-06-03 09:10:39,221: WARNING - A repository already exists at ssh://xxx@xxx:22/~/backup.
2021-06-03 09:10:39,249: DEBUG - + set -e
2021-06-03 09:10:39,250: DEBUG - + borg create ssh://xxx@xxx:22/~/backup::_auto_conf-2021-06-03_09:10 ./
2021-06-03 09:10:39,250: DEBUG - + log_with_timestamp
2021-06-03 09:10:39,250: DEBUG - ++ date +%Y-%m-%d_%H:%M:%S
2021-06-03 09:10:39,251: DEBUG - + sed -e 's/^/[2021-06-03_09:10:39] /'
2021-06-03 09:10:41,254: ERROR - Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app
Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/hook.py", line 307, in hook_callback
    path, args=hook_args, chdir=chdir, env=env, raise_on_error=True
  File "/usr/lib/moulinette/yunohost/hook.py", line 386, in hook_exec
    raise YunohostError("hook_exec_failed", path=path)
yunohost.utils.error.YunohostError: Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app
deckname commented 3 years ago

I think the error now is with borg_ynh not borgserver_ynh