en:desktop:services:rsync

This is an old revision of the document!


rsync

rsync is an open source utility that provides fast incremental file transfer. rsync is freely available under the GNU General Public License.

pacman -S rsync
rsync --recursive --links --times --owner --group --itemize-changes --partial --progress --human-readable --verbose --stats /local/path user@host:~/path/

From ssh to local:

rsync --recursive --links --times --owner --group --itemize-changes --partial --progress --human-readable --verbose --stats user@host:~/path/ /local/path

Short:

rsync -rltogiPhv --stats /local/path user@host:~/path/
rsync -rltogiPhv --stats user@host:~/path/ /local/path

Different port:

rsync -rltogiPhv --stats -e "ssh -p PORTNUMBER" /local/path user@host:~/path/

See what each option does - https://man.archlinux.org/man/rsync.1#OPTION_SUMMARY

echo "$user:$password" > /etc/rsyncd.secrets
chmod 400 /etc/rsyncd.secrets

Change $user.

nano /etc/rsyncd.conf
[archive]
path = /path/
comment = Archive
timeout = 300
read only = false
# http user if you want to have access via web
#uid = 33
#gid = 33
# Run a script before and after a connection
#pre-xfer exec = /root/before_script.sh
#post-xfer exec = /root/after_script.sh
# Security
auth users = $user      
secrets file = /etc/rsyncd.secrets
# Optional
#hosts allow = 192.168.1.0/255.255.255.0
systemctl enable --now rsyncd.service

Change $DAEMONUSER and $DAEMONHOST.

rsync --rltogiPhv --stats /local/path rsync://$DAEMONUSER@$DAEMONHOST/archive/path/

Go to our backup tutorial.

2022/02/25 20:04 · dan
  • en/desktop/services/rsync.1645819790.txt.gz
  • Last modified: 2022/10/24 08:24
  • (external edit)