I made a progress bar for rsync in a wrapper. With --info=progress2 from new versions of rsync no patching is necessary.
Usage - replace rsync with rsyncy:
rsyncy -a FROM/ TO
More info on GitHub, install with pip3 install --user rsyncy
I got this error error when the target directory didn't pre-exist. With a source data file: /a/b/c/d/data,
rsync -av -e ssh /a/b/c/d/ hostname:/a/b/c/d
needs the target directory: hostname:/a/b/c to pre-exist.
In reading the man page as a last resort I see that this is the intended behavior.
Just use --inplace option:
rsync --inplace SRC $remote:DEST
Correctly does not change destination ownership (or permissions), regardless of what the source's are.
This option changes how rsync transfers a file when the file's data
needs to be updated: instead of the default method of creating a new
copy of the file and moving it ...
Identify the user and group on the remote end. Example user "user1" and group "user1".
add "--chown user1:user1" to your rsync command
Alternatively if your version of rsync does not support that, on the remote, run "chown -R user1:user1 *" inside the highest folder of your destination file tree and this will ...
rsync is looking at the wrong place, because those paths are relative (from the rsync man page, emphasis mine):
The filenames that are read from the FILE are all relative to the
Either send absolute paths to the files-from option, but do not additionally define a source directory other than the root (/). This should work - ...
Please be sure you're not on a hacked machine, a lot of users (me included) have found bitcoin miners hiding behind rsync or other processes.
look at users cron jobs: # crontab -l -u alex
Delete folders listed in found malicious cron jobs
Delete hidden folders in /tmp
Delete unknown keys in /home/USER/.ssh/authorized_keys or worse /root/.ssh/...
To avoid using root, you could create a dedicated rsync user, say rsync, on both hosts, and add file ACLs to give it read/write permissions:
# Primary: make source files readable
setfacl -R -m u:rsync:rX,d:u:rsync:rX /etc/letsencrypt /etc/nginx
# Replica: make target files writeable
setfacl -R -m u:rsync:rwX,d:u:rsync:rwX /etc/letsencrypt /etc/nginx
Excellent question. rsync is really just used for "one way" mirroring. For your scenario, consider the use of Unison (see https://www.cis.upenn.edu/~bcpierce/unison/) which is a 2-way synchronisation tool. It can handle conflicts nicely, but if you only want to sync in one way, take a look at the --force or --prefer options.
apt install unison ...