If you plan to run this manually, use your normal ssh user sync with /home/user-data/backup/encrypted/. That directory contains the encrypted backup files, which are an incremental back up run every night by MiaB.
The private encryption key is stored in /home/user-data/backup/secret_key.txt, which should be downloaded and stored in a very safe place.
If you plan to set up a job to automatically sync, I recommend creating another MiaB user that is not in the sudo group and have that user download the backups.
You can read the files just fine as the entire directory tree has r-x for all users, so that means you can copy them to your backup device, which is all that is required in most backup situations, which as best I can tell should work for your above description.
If rsync is trying to write to the directory, then I’m very unclear on what you are trying to accomplish or on what your question is.
From my home computeur, I want to back-up my mail in box server.
So, from my home computeur I do
rsync -az box.hostname.xx:/home/user-data/backup/encrypted .
I get permission error.
It seems to be because the file inside the encrypted folder are in -rw-------
encrypted$ ls -alrt
total 129744
-rw------- 1 user-data root 127045766 Mar 5 03:19 duplicity-full.20210305T021905Z.vol1.difftar.gpg
-rw------- 1 user-data root 5443192 Mar 5 03:19 duplicity-full-signatures.20210305T021905Z.sigtar.gpg
-rw------- 1 user-data root 230 Mar 5 03:19 duplicity-full.20210305T021905Z.manifest.gpg
If I change the file with permission 644 instead of 600
i get the rsync to work…
But is that the right solution ?
what if new file are created ?
edit /etc/mailinabox.conf and change to :
STORAGE_USER=feydreva
STORAGE_ROOT=/home/feydreva/mailinabox-backup
create /home/feydreva/mailinabox-backup/backup/
move secret-key.txt to /home/feydreva/mailinabox-backup/
sudo mailinabox/management/backup.py
Now all file are created by user feydreva
Now on my PC, I can do
rsync -az box.hostname.xx:/home/feydreva/mailinabox-backup/backup/encrypted /mnt/data/backup/mailinabox/
without any error, and without permission error.
I cannot explain why there is a difference, but my encrypted files are all 644, so I can have a different user access the files for rsync.
I vaguely recall I did make some very minor change when I configured the backups years ago. You might try just chmod 644 and the nightly MiaB backups maybe just write new files with same permissions as the previous files.
I left the /etc/mailinabox.conf unchanged, as it was by default. (because it messed up things)
To get your file from /home/user-data/backup/encrypted that are root:root with 600 permission you need to rsync as root, but with no root access it is problematic.
there is a way ! :
rsync -avz -e “ssh” --rsync-path=“sudo rsync” box.hostname.xx:/home/user-data/backup/encrypted /data/backup/MailInabox/.
You need your rsync user feydreva in my case in my PC and in the remote VPS to be able to run rsync wihtout password.
For that :
$ sudo visudo
At the end of the file :
feydreva ALL= NOPASSWD:/usr/bin/rsync
this allow the user to run sudo rsync wihout password.
This way, I can backup my remote backup file to my local mahcine without any error.
The user can sudo and do anything else to the server, so this is not a good solution. Did you try the one I suggested of changing the file permissions? I haven’t done any of your suggested solutions and my backup completes every night for years now.
the backup completes every night on the VPS, I have no issue with that.
I want the files out of the server once in a while. I will set up a crontab on my home computeur that get s them.
I tried changing the file permission, but new file are created in 600 and not 644
user can only do sudo rsync with no password. All other sudo command will ask for password.
user as to have the ssh key to log in. I have disable other form of login to the server.
So i am not worried about security here.
I run this as a daily cron job from the server I want the backup stored on. I use a custom SSH port and the box’s IP address rather than the hostname. YMMV.
That is similar to what I run. Are the file permissions of the backup files 644? Because that is what mine are, but I don’t recall whether I changed anything from default MiaB install to achieve that.