- I'm trying to make a rootfs backup from
ServerA
on toServerB
. - The connection is one way and is initialized from
ServerB
usingrsnapshot
. - I have made a
backup
account onServerA
and enabled paswordless sudo only forrsync
What I'm trying to accomplish:
- Change the
authorized_keys
file onServerA
, so only thersync
command can be used via ssh.
On ServerB
- /etc/rsnapshot.conf
is setup to run rsync
with the following args:
rsync_long_args --rsync-path="sudo rsync" --delete --numeric-ids --relative --delete-excluded
I have tried the following on ServerA
:
from="ServerB",command="sudo rsync *" ssh-ed25519 SSH-KEY
But rsnapshot
keeps crashing and giving IO error codes for rsync
.
What am I missing here?
!! Problem Solved !!
Found out about rrsync ---
/usr/share/doc/rsync/scripts/rrsync
, copy it to wherever.ServerA:authorized_keys --- command="sudo /usr/local/bin/rrsync -ro /backup"
Since I'm keeping a copy of the backups on
ServerA
, I might as well rsync from them instead of using rsnapshot onServerB
. (This was my initial idea, but it doesn't work since there are duplicate files because of links that rsnapshot creates, I ended up having rsnapshot running both onServerA
andServerB
, to save backups fromServerA
to a localDir onServerA
and also make remote snapshots fromServerA
toServerB
.)ServerA
:rsync -ax --delete --numeric-ids --relative ServerA:/ /ServerB-backup/
Now works as expected.
Note that the path on
ServerA
in the command above is relative to the rule set in authorized_keys.