zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Rsync Server

July 8, 2011 by Igor Drobot Leave a Comment

Another different method to create your backups over network, a client data establish a connection to a rsync daemon server.

I describe a simple method without authentication (trusted LAN).

First thing is to install rsync:

1
apt-get update && apt-get install rsync

apt-get update && apt-get install rsync

Create a public directory for your backups and make it writable:

1
2
mkdir /var/backups/my_network
chmod 777 /var/backups/my_network

mkdir /var/backups/my_network chmod 777 /var/backups/my_network

Enable rsync daemon (by default disabled!):

1
2
3
4
vim /etc/default/rsync
RSYNC_ENABLE=false
# to
RSYNC_ENABLE=true

vim /etc/default/rsync RSYNC_ENABLE=false # to RSYNC_ENABLE=true

Thats not all, you still need to modify inetd’s config yourself:

1
2
3
vim /etc/inetd.conf
# add this single line to inetd.conf
rsync   stream  tcp     nowait  root   /usr/bin/rsync rsyncd --daemon

vim /etc/inetd.conf # add this single line to inetd.conf rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

from: man rsyncd.conf
Rsync will run on port rsync 873/TCP, which is defined in: /etc/services

1
2
3
4
5
6
7
8
9
10
11
12
13
# content of rsyncd.conf
[backups]
comment = For backups
path = /var/backups/my_network
use chroot = true
uid = backup
gid = backup
log file = /var/log/rsyncd/backups.log
read only = false
write only = false
hosts allow = 192.168.3.0/24
hosts deny = *
transfer logging = false

# content of rsyncd.conf [backups] comment = For backups path = /var/backups/my_network use chroot = true uid = backup gid = backup log file = /var/log/rsyncd/backups.log read only = false write only = false hosts allow = 192.168.3.0/24 hosts deny = * transfer logging = false

And finally rsync daemon can bes started:

1
/etc/init.d/rsync start

/etc/init.d/rsync start

Check the rsync status(or ps fax):

1
2
root@server:~# service rsync status
rsync is running.

root@server:~# service rsync status rsync is running.

If your rsync daemon was successfully started, you can make a local test connection:

1
2
3
root@server:~# rsync rsync://localhost
# you will get a answer
backups         For backups

root@server:~# rsync rsync://localhost # you will get a answer backups For backups

Use rsync with proxy

1
export RSYNC_PROXY=192.168.3.36:8080

export RSYNC_PROXY=192.168.3.36:8080

Try to sync a file:

1
rsync deli-0.8.0-core.iso rsync://192.168.3.213/backups/

rsync deli-0.8.0-core.iso rsync://192.168.3.213/backups/

The connection was denied by proxy. From squid access log:

1
CONNECT 192.168.3.213:873 HTTP/1.0 403 3391 TCP_DENIED:NONE

CONNECT 192.168.3.213:873 HTTP/1.0 403 3391 TCP_DENIED:NONE

Allow rsync port in your squid.conf:

1
2
acl Safe_ports port 873
acl SSL_ports port 873

acl Safe_ports port 873 acl SSL_ports port 873

After fixing squid.conf we get a positive result:

1
CONNECT 192.168.3.213:873 HTTP/1.0 200 55803 TCP_MISS:DIRECT

CONNECT 192.168.3.213:873 HTTP/1.0 200 55803 TCP_MISS:DIRECT

Filed Under: Linux Tagged With: backup, rsync, rsync server, Squid, squid.conf, Webfilter

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *