Run rsync in server mode on VMware ESXi 4.0

This procedure has been tested on ESXi 4.0 only

First I was unable to upload files through rsync running in server mode !!! Only downloads are working ! rsync can also be started using a remote shell like ssh using -e option. Used this way, rsync can be used to download and upload. Anyway the use of the ssh layer and its encryption increase CPU load.

rsync can be started standalone or via inetd. standalone fails then I used inetd to start rsync.

You can find the rsync binary and some configuration files here rsync-esxi.zip.

Because VMware refresh its directories at every reboot, you need to put your files in one of your datastore. I will call it /vmfs/volumes/datastore1. We will put all our files into the misc sub-directory this way:

/vmfs/volumes/datastore1
   `-- misc
       |-- etc
       |   |-- rsyncd.conf
       |   |-- rsyncd.secrets
       `-- sbin
           `-- rsync

You need to restrict access to the rsyncd.secrets file, and be sure rsync binary is runnable.

# chmod 600 /vmfs/volumes/datastore1/misc/etc/rsyncd.secrets
# chmod a+rx /vmfs/volumes/datastore1/misc/sbin/rsync

Edit rsyncd.conf and rsyncd.secret to meet your need. You can create sections and limit access to some users only.

secrets file = /vmfs/volumes/datastore1/misc/etc/rsyncd.secrets
log file = /var/log/rsyncd.log
use chroot = no
read only = yes
list = yes
uid = 0
gid = 0

[root]
comment = root directory
path = /
auth users = rsync
hosts allow = *
list = true
read only = true

store your rsync's users in rsyncd.secrets. When used via inetd, you don't need to restart any services when you modify these two files. /etc/inetd.conf

rsync:secret

Then add this line at end of your /etc/inetd.conf.

rsync   stream  tcp     nowait  root    /vmfs/volumes/datastore1/misc/sbin/rsync --config=/vmfs/volumes/datastore1/misc/etc/rsyncd.conf --daemon

To restart inetd follow this procedure :

~ # ps  | grep inetd
3834250 3834250 busybox              inetd
~ # kill 3834250
~ # inetd

To access your file from rsync use the command:

# rsync rsync://rsync@your_host:/root/etc/hosts  myesxhostsfile

To use rsync via SSH, you must setup --rsync-path because rsync is not in the expected location.

# rsync -e ssh --rsync-path=/vmfs/volumes/datastore1/misc/sbin/rsync  root@your_host:/etc/hosts  myesxhostsfile

Add new comment