Setting Up an Rsync Daemon for Network-Wide Backups (Ultimate Guide)

"Stability is the goal of IT operations, but anomalies are the daily reality."
Photo by Joshua Tsu / Unsplash

πŸš€

Setting up an Rsync Daemon (rsyncd) is one of the most efficient ways to synchronize and back up data across multiple servers. Unlike traditional Rsync over SSH, Rsync daemon operates as a standalone service, allowing multiple clients to connect simultaneously for high-speed, parallel backups over the network.

This step-by-step guide will show you how to install, configure, and optimize an Rsync Daemon, covering security, authentication, performance tuning, and troubleshooting.


πŸ“Œ What You’ll Learn

βœ… How to install and enable Rsync daemon (rsyncd)
βœ… How to configure authentication and access control
βœ… How to secure Rsync daemon from unauthorized access
βœ… How to optimize performance for large-scale backups
βœ… How to troubleshoot common Rsync server issues

πŸ”Ή Suitable for: IT professionals, system administrators, and DevOps engineers
πŸ”Ή Skill Level: Beginner β†’ Advanced


πŸ” 1. What Is Rsync Daemon and Why Use It?

Unlike traditional Rsync over SSH, Rsync Daemon runs as a persistent background service, allowing multiple clients to access it without requiring SSH authentication.

πŸ”Ή Benefits of Rsync Daemon (rsyncd)

βœ… Faster than Rsync over SSH – No SSH encryption overhead, faster transfers
βœ… Multiple clients can connect at once – Ideal for enterprise-wide backups
βœ… Can work without user login – Useful for headless systems & restricted environments
βœ… Custom authentication and access control – Securely define who can sync what

πŸ“Œ Common Use Cases:

  • Centralized backup server receiving files from multiple clients
  • Mirroring servers or shared storage systems over LAN
  • Automated, scheduled backups without needing SSH keys

πŸ› οΈ 2. Installing and Enabling Rsync Daemon

Most Linux distributions come with Rsync pre-installed, but if not, install it first.

βœ… For Debian/Ubuntu:

sudo apt update && sudo apt install rsync -y

βœ… For CentOS/RHEL:

sudo yum install rsync -y

βœ… For Arch Linux:

sudo pacman -S rsync

βœ… Verify Rsync Installation:

rsync --version

πŸ“Œ Expected Output:

rsync  version 3.2.3  protocol version 31

βš™οΈ 3. Configuring Rsync Daemon (rsyncd)

πŸ”Ή Step 1: Create Rsync Daemon Configuration File

The Rsync Daemon is configured using /etc/rsyncd.conf.

βœ… Create or Edit /etc/rsyncd.conf:

sudo nano /etc/rsyncd.conf

βœ… Add the following configuration:

# Global Settings
uid = rsync
gid = rsync
use chroot = no
max connections = 10
log file = /var/log/rsyncd.log
timeout = 300
read only = no

# Backup Module
[backup]
    path = /data/backup
    comment = Rsync Backup Directory
    read only = no
    list = yes
    auth users = backupuser
    secrets file = /etc/rsyncd.secrets

πŸ“Œ Explanation of Key Settings:

  • uid/gid = rsync β†’ Runs Rsync under a non-root user for security
  • max connections = 10 β†’ Limits concurrent users to prevent overload
  • log file = /var/log/rsyncd.log β†’ Enables logging for monitoring
  • [backup] β†’ Defines a named module accessible over the network
  • auth users = backupuser β†’ Enables authentication for secure access
  • secrets file = /etc/rsyncd.secrets β†’ Stores user credentials securely

πŸ”Ή Step 2: Create Rsync Authentication File

Since we enabled authentication (auth users), we need to define user credentials.

βœ… Create /etc/rsyncd.secrets:

sudo nano /etc/rsyncd.secrets

βœ… Add a user credential:

backupuser:securepassword

βœ… Secure the file:

sudo chmod 600 /etc/rsyncd.secrets

πŸ“Œ Permissions must be strict; otherwise, Rsync will refuse to use it.


πŸ”Ή Step 3: Start and Enable Rsync Daemon

βœ… Start Rsync in daemon mode:

sudo rsync --daemon

βœ… Enable Rsync to start at boot:

sudo systemctl enable rsync

βœ… Check if Rsync daemon is running:

sudo systemctl status rsync

πŸ“Œ Expected Output:

● rsync.service - fast remote file copy program daemon
   Active: active (running)

βœ… Verify Rsync is listening on port 873:

sudo netstat -tulnp | grep rsync

πŸ“Œ By default, Rsync daemon listens on TCP port 873.


πŸ”„ 4. Connecting to Rsync Daemon from a Client

πŸ”Ή Listing Available Rsync Modules

To see which directories are available on the Rsync server:

rsync rsync://remote-server/

πŸ“Œ Expected Output:

backup          Rsync Backup Directory

πŸ”Ή Pulling Data from Rsync Server

To download files from the Rsync server:

rsync -av rsync://backupuser@remote-server/backup/ /local/backup/

πŸ“Œ You will be prompted for the password (stored in /etc/rsyncd.secrets).

πŸ”Ή Pushing Data to Rsync Server

To upload files to the Rsync server:

rsync -av /home/user/data/ rsync://backupuser@remote-server/backup/

πŸ“Œ Ensure read only = no is set in /etc/rsyncd.conf to allow uploads.


πŸ›‘οΈ 5. Securing Rsync Daemon

πŸ”Ή Restrict Access to Trusted IPs

Modify /etc/rsyncd.conf:

hosts allow = 192.168.1.0/24
hosts deny = *

πŸ“Œ Only devices from 192.168.1.x can access Rsync.

πŸ”Ή Use SSH Tunneling for Encryption

By default, Rsync does not encrypt data. Secure it by tunneling Rsync traffic over SSH:

ssh -L 873:localhost:873 user@remote-server
rsync -av rsync://localhost/backup/ /local/backup/

πŸ“Œ This encrypts all Rsync traffic.


⚠️ 6. Troubleshooting Common Rsync Daemon Issues

Issue Solution
Connection Refused Check if Rsync daemon is running: sudo systemctl status rsync
Authentication Failed Ensure /etc/rsyncd.secrets has correct permissions (chmod 600)
Cannot Write to Backup Folder Set read only = no in /etc/rsyncd.conf
Rsync Daemon Not Starting Check /var/log/rsyncd.log for errors

βœ… Debug Rsync Daemon with Verbose Mode:

sudo rsync --daemon --no-detach --debug=ALL

πŸ“Š 7. Summary

Feature Rsync Daemon Advantage
Multi-Client Access Multiple users can connect simultaneously
Faster than SSH Rsync Direct TCP connections reduce CPU load
Access Control Authentication via rsyncd.secrets
Centralized Backup Server Efficient data syncing across the network

βœ… Rsync daemon is an ideal solution for setting up a high-speed, multi-client backup system.


πŸ’¬ Join the Discussion!

Have you set up an Rsync daemon for large-scale backups?
How do you handle security and authentication for Rsync servers?

πŸ’¬ Share your experience in the comments below! πŸš€

πŸ‘‰ Next Up: Optimizing Rsync Daemon for High-Performance Backups

Read more