My Tiny Box

How to enable server-side logging when using rsync over ssh

21/10/2009 à 12:06:19

As rsyncd, the rsync daemon, only supports encryption for authentication, and not for the file-transfer itself, it might be a good idea to switch to rsync over ssh, especially when rsync-ing over the Internet.

But there's a drawback : you cannot enable server-side logging directly from the server, as you would do with the rsyncd daemon.

Here's a workaround for enabling server-side logging from the rsync client :

rsync -av --rsync-path="rsync --log-file=/tmp/rsync.log" -e ssh user@host:/remote_dir local_dir

But it turned out that there is a way to enable server-side logging from the server, even if it does not seem to be well-documented. You can create an rsyncd.conf file in the home directory of the user used for ssh. Here's the one I use :

id file = /home/user/var/run/
log file = /home/user/log/rsync.log
lock file = /home/user/var/run/rsync.lock
uid = user
gid = user
use chroot = no
max connections = 4
transfer logging = true

comment = export_name
path = /mnt/disk/dir
read only = yes
list = no
hosts allow = ip_address

You can then rsync this way :

rsync -av -e ssh user@host::export_name local_dir

Note : specifying the ssh port to use is done this way:

rsync -av -e 'ssh -p port' user@host::export_name local_dir

rsync, ssh

Aucun commentaire

Flux RSS des commentaires de cet article

Les commentaires sont fermés pour cet article