Child pages
  • rsync daemon service on OpenIndiana
Skip to end of metadata
Go to start of metadata

As of December 2011, OpenIndiana still does not include a service manifest for running an rsync daemon out of the box. Until this changes, others may find the following service manifest and method files helpful.

This has been tested in OpenIndiana 151a.

Install and configure the SMF service for rsync and the daemon itself

Before starting with this guide, make sure that rsync software is installed on the machine. It is not installed per default in local zones, but can be done so with pkg

pkg install network/rsync

Prepare files for SMF services configuration

To see all attachments described in this page, click on the small paper clip icon at the top left.

Add SMF manifest and method scripts, and initial configuration for rsync itself (as root):

  • copy (or wget) the attached file "rsyncd.xml" to: /var/svc/manifest/network/rsyncd.xml
  • copy (or wget) the attached file "rsyncd" to: /lib/svc/method/rsyncd
  • set the execute permission on the above file for user root:

    chmod u+x /lib/svc/method/rsyncd

    (Thanks to for pointing out that I missed the above chmod step)

  • copy (or wget) the attached file "rsync" to: /etc/default/rsync
    NOTE that the variable RSYNC_ENABLE is already set to true in this file.
  • now create a valid /etc/rsyncd.conf file. This must be done or the service will not run.
    For a full list of options see: man rsyncd.conf

For an example see this trivial /etc/rsyncd.conf file:

use chroot = yes
read only = yes
log file = /var/adm/rsyncd_upload.log
log format = - %a - %f
transfer logging = yes

#module to share ISO files
path = /lift/data/ISO
comment = public ISO repository

Import the SMF service manifest

Now you can import the SMF service manifest with the following code:

svccfg -v import /var/svc/manifest/network/rsyncd.xml

Next check to see the status of the rsyncd service – it should be defined but may be not running yet:

svcs -a | grep rsyncd should see something like this:

offline          2:04:55 svc:/network/rsyncd:default

Enable the SMF service

Now you need to enable the service:

svcadm enable network/rsyncd

Test that the service is enabled and the daemon actually runs

Now execute the svcs command again and also execute ps:

svcs -a | grep rsync

The service should be listed as online now:

online         May_16   svc:/network/rsyncd:default

Now execute:

ps aux | grep rsync

you should see something like this

root     13351  0.0  0.0 2688 1340 ?        S 02:04:55  0:00 /usr/bin/rsync --d

Test from a client

Note – if you add new modules to /etc/rsyncd.conf you should not have to restart the rsyncd service, as the file is read each time an rsync client connects.

Congrats, your rsyncd should be working now. Test it out from a client machine using a small file for testing with something like:

rsync servername::ISO/some_file.iso /localpath/here/

or just get a list of the files and/or directories by using verbose mode and piping to less:

rsync -v servername::ISO | less

Consult the log file referenced in your rsyncd.conf file to see info on file transfers. (In this example /var/adm/rsyncd_upload.log).

Thanks to Marcelo Leal for the rsyncd method file (changed here to point to /usr/bin/rsync) and also for parts of the service manifest.

Optional – add automatic ZFS snapshots after rsync uploads

You might want to create ZFS snapshots linked to your incoming rsync upload jobs – for example, after a machine backing up to your OpenIndiana server disconnects its rsyncing session. Tricks like this can be done by defining a post-xfer-exec hook pointing to a script which handles the logic, in this case

Expanding on a trivial example above, here is another one:

use chroot = yes
read only = yes
log file = /var/adm/rsyncd_upload.log
log format = - %a - %f
transfer logging = yes
pid file = /var/run/
lock file = /var/run/rsyncd.lock

#module to share ISO files
path = /lift/data/ISO
comment = public ISO repository

#Module available only to a multihomed host which backs up into this path
#and chowns the files to specified UID:GID and sets FS access rights
#(source is a Windows machine with separate user namespace); it is also
#recommended that each backed-up host has a dedicated backup ZFS dataset.
#When a backup attempt is complete, a ZFS snapshot is created, so we can
#walk back to any given complete backup image (i.e. via .zfs/snapshots
#directory with Samba/kCIFS sharing, or via MS Shadow Volumes with kCIFS)
    path = /export/DUMP/windows/JAMAIS
    read only = no
    auth users = backup-jamais
    charset = UTF-8
    ### NOTE: cwRsync clients might require "--iconv=cp1251" on their command
    ###       line to properly upload russian-named files from Windows
    uid = backup-jamais
    gid = backup-jamais
    incoming chmod = Dug=rwX,o-rwx,Fug=rw,o-rwx
    hosts allow =
    post-xfer exec = /root/ -w -v -l -ok

The main trickery for this particular quest is in the script attached to this post. It has a number of command-line options to control logging and verbosity, as well as to enable actual snapshotting (dry-runs by default), and perhaps only when the rsync upload was successful (without an rsync error status set). Hopefully, the code and comments (and command-line help) are its best documentation.

  • copy (or wget) the attached file "" to: /root/ or any other location referenced in your config file module above
  • set the execute permission on the above file for user root:

    chmod u+x /root/
  • You might be required to also delegate the ZFS snapshooting access rights to the backup user (but test first to see if this is really needed):

    zfs allow -l -d -u backup-jamais snapshot,rename,mount \

    NOTE: the -l -d options set this permission locally on the named dataset and on its descendants, including those created in the future.



  1. Anonymous


    rsyncd file displays this usage:

      echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart}"

    This should be rewritten, or?
    It uses SMF and should be maintained with svccfg command.

    Thanks for this nice guide.
    Best regardss
    Predrag Zecevic

    1. The usage on that file is incorrect, and should be updated. I pulled the file from a GNU/Linux distro and never updated the usage section with the correct info.

      In this how to guide, we are using the svcadm command to disable, enable, and restart the rsync service.

  2. Anonymous

    Thank you this was a huge help. Can't believe how hard it was to find a solution to something as simple as getting rsync running!

  3. Well, I've done some similar work based on Marcelo Leal's blog entry - but I've somewhat "SMF-ized" the method script, and did not get to publishing the thing (I thought it was included in the OS since then). I'll attach it as rsyncd-smf here, and you might want to revise it and replace the one you've customized (smile)

    Here's the diff which should highlight the changes:

    SMFized changes to rsync method script (compared to Marcelo Leal's original)
    --- /tmp/rsync  2008-11-11 21:00:22.000000000 +0300
    +++ /lib/svc/method/rsync       2009-01-11 20:51:19.000000000 +0300
    @@ -3,29 +3,40 @@
     # /lib/svc/method/rsync: start and stop the RSYNC daemon
    +# Copyright 2008 Marcelo Leal,
    +# Modded for OpenSolaris rsync (SUNWrsync) (C) 2009 by Jim Klimov
    +[ -f /lib/svc/share/ ] && . /lib/svc/share/
    -test -x $DAEMON || exit 0
    +if [ ! -x "$DAEMON" ]; then
    +    echo "rsync binary not found (as $DAEMON)"
    +    exit $SMF_EXIT_ERR_CONFIG
     if [ -s $RSYNC_DEFAULTS_FILE ]; then
         case "x$RSYNC_ENABLE" in
             xtrue|xfalse)   ;;
    -        xinetd)         exit 0
    +        xinetd)         exit $SMF_EXIT_OK
             *)              echo "Value of RSYNC_ENABLE in $RSYNC_DEFAULTS_FILE must be either 'true' or 'false';"
                             echo "not starting rsync daemon."
    -                        exit 1
    +                        exit $SMF_EXIT_ERR_CONFIG
    -export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
    +export PATH="${PATH:+$PATH:}/usr/local/bin:/usr/sbin:/sbin"
    +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/local/lib:/usr/lib:/lib"
     case "$1" in
    @@ -33,18 +44,21 @@
                 echo -n "Starting rsync daemon: rsync"
                if [ -s $PIDFILE ] && kill -0 $(cat $PIDFILE) >/dev/null 2>&1; then
                    echo " apparently already running."
    -               exit 0
    +               exit $SMF_EXIT_OK
                 if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
                     echo " missing or empty config file $RSYNC_CONFIG_FILE"
    -                exit 1
    +                exit $SMF_EXIT_ERR_CONFIG
                    $DAEMON --daemon --config="$RSYNC_CONFIG_FILE" $RSYNC_OPTS
                 echo "."
                 if [ -s "$RSYNC_CONFIG_FILE" ]; then
                     echo "rsync daemon not enabled in /etc/default/rsync"
    +           else
    +               echo "rsync daemon not enabled in /etc/default/rsync and missing or empty config file $RSYNC_CONFIG_FILE"
    +           exit $SMF_EXIT_ERR_CONFIG
    @@ -72,7 +86,7 @@
                 if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
                     echo " missing or empty config file $RSYNC_CONFIG_FILE"
    -                exit 1
    +                exit $SMF_EXIT_ERR_CONFIG
                 sleep 5
                 $DAEMON --daemon --config="$RSYNC_CONFIG_FILE" $RSYNC_OPTS
    @@ -83,13 +97,20 @@
                     echo "."
    +            if [ -s "$RSYNC_CONFIG_FILE" ]; then
                 echo "rsync daemon not enabled in /etc/default/rsync"
    +           else
    +               echo "rsync daemon not enabled in /etc/default/rsync and missing or empty config file $RSYNC_CONFIG_FILE"
    +            fi
    +           exit $SMF_EXIT_ERR_CONFIG
            echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart}"
    -       exit 1
    +       exit $SMF_EXIT_ERR_CONFIG
    -exit 0
    +exit $SMF_EXIT_OK
  4. Thanks Jim, that looks great.

  5. Hi,

    why running daemon, you can instruct inetd to start rsync on demand?

    So, instead of getting manifest file and its method (rsync.xml and rsyncd) file, you can do (assuming superuser role):

    $ echo "rsync   stream  tcp     nowait  root    /usr/bin/rsync  rsync --daemon --config=/etc/rsyncd.conf" > /tmp/rsync-inetd.conf
    $ inetconv -i /tmp/rsync-inetd.conf
    rsync -> /lib/svc/manifest/network/rsync-tcp.xml
    Importing rsync-tcp.xml ...Done

    Then, you can check it:

    $ inetadm | grep rsync
    enabled   online         svc:/network/rsync/tcp:default
    $ inetadm -l svc:/network/rsync/tcp:default
    inetadm -l svc:/network/rsync/tcp:default
             exec="/usr/bin/rsync --daemon --config=/etc/rsyncd.conf"

    That is it. Eventually, you can check with

    telnet localhost 783
    and you can forget on /etc/default/rsync file (i guess)


    1. First of all, thanks for sharing this trick - it is neat (wink)

      Second, the original SMF manifest and method somewhat ensured presence of proper configuration before allowing access to the service, which may be an important factor perhaps even with security implications (unless it is not startable with default absence of config). Also, in case of third-party builds of rsyncd, a method script allowed to set needed LD_LIBRARY_PATH and run other logic.

      Your trick does not preclude running the automatic snapshots script (it is called via rsyncd.conf), so it is quite a worthy and simple alternative to an explicit service, to say the least.

      A modest usability downside of inetd services is their naming – to manage the service you need to svcadm ACTION rsync/tcp instead of just svcadm ACTION rsync. However, since reconfiguration would no longer be relevant with single-shot daemons, only the rare enable/disable remain, so it is of little inconvenience.

      //Jim Klimov