Skip to content

Rsync

Configuration

/etc/rsyncd.conf

toml
## /etc/rsyncd: configuration file for rsync daemon mode

## See rsyncd.conf man page for more options.

## configuration example:

port = 873

uid = root
gid = root
 
use chroot = yes
max connections = 50
strict modes = yes
 
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log

[foo]
  path = /opt/local-path-provisioner/pvc-xxx
  comment = foo
  ignore errors
  hosts allow = *
  auth users = user
  secrets file = /etc/rsyncd.pass

[bar]
   path = /opt/local-path-provisioner/pvc-xxx
   comment = bar
   ignore errors
   read only = no
   write only = no
   hosts allow = *
   auth users = user
   secrets file = /etc/rsyncd.pass

SSH Auth

bash
rsync -avz -e ssh source_file user@remote_host:/path/to/destination

Password Auth

bash
rsync -aqvhP --stats --port=873 --delete --password-file=/etc/rsyncd.password source_file user@x.x.x.x::foo/xxx/

Concurrency Example

  • -P 20: Runs up to 20 instances of the command in parallel.
bash
echo xxx | xargs -P 20 -I '{}' rsync -aqvhP --stats --delete '/backup/@hashed/{}' /backup/tmp/@hashed/

Exclude Example

bash
rsync -aqvhP --stats --delete --exclude @hashed /backup/ /backup/tmp/