Rsync

Using rsync to List and Copy Files Over the rsync Protocol

rsync is a highly efficient utility for synchronizing files and directories between local and remote systems. It is widely used for backups, mirroring, and incremental data transfers. When used over the native rsync protocol (default port 873), it can communicate directly with rsync daemons running on remote servers.


1. Check Server Accessibility

Before attempting to list or copy files, verify that the target machine is running an rsync daemon and accessible via port 873:

nc target1.ine.local 873

If the connection is successful, it indicates that the rsync service is up and accepting connections.


2. List Available Shares

To view the publicly accessible shares (modules) offered by the remote rsync server:

rsync -av --list-only rsync://target/

Explanation of Options:

  • -a: Archive mode; preserves symbolic links, permissions, timestamps, etc.

  • -v: Verbose; provides detailed output.

  • --list-only: Displays remote contents without performing a transfer.

This command lists available directories or modules that the rsync daemon has exposed.


3. Copy Files from a Remote Directory (No Authentication)

After identifying the desired directory (e.g., public_share), copy its contents to your local directory using:

rsync -av rsync://target/public_share /path/to/destination

This command initiates the transfer of files and subdirectories from the remote share to the specified local path.


Example Workflow

# Check if rsync daemon is accessible
nc target1.ine.local 873

# List available shares
rsync -av --list-only rsync://target1.ine.local/

# View contents of a specific share
rsync -av --list-only rsync://target1.ine.local/files

# Copy contents of 'files' share
rsync -av rsync://target1.ine.local/files ~/Downloads/files_backup

References

Last updated