Monthly Archives: January 2015

Simple differential backups using rdiff-backup

As a user I want to have differential backups of my documents and git directories from my computer at work to my remote off-site server.

Frequency of backups is one time a day at 1:00 AM.
Retention policy is to keep backups 12 months.

Install rdiff-backup on source computer and on destination server also.

apt-get install rdiff-backup

First you have to copy SSH public key from your source computer at work to remote server.


Edit crontab as a backup user on source computer.

crontab -e

00 1 * * *       rdiff-backup /data/documents 1> /dev/null
01 1 * * *       rdiff-backup /data/git 1> /dev/null
02 1 * * *       rdiff-backup --remove-older-than 12M --force 1> /dev/null
25 1 * * *       rdiff-backup --remove-older-than 12M --force 1> /dev/null

On remote server create destination directories and make sure user backup is owner of it.

mkdir /disk/backup/{documents,git}
chown backup /disk/backup/{documents,git}

From source computer run firs backup manually and check results on destination computer.

rdiff-backup /data/documents
rdiff-backup /data/git

Setup centralised Syslog server


Open access in UFW firewall port 514 tcp/udp:
ufw allow from port 514

mkdir /var/log/rsyslog
chown root:adm /var/log/rsyslog

The following code in 90-rsyslog.conf should be placed before the “*.info;mail.none;authpriv.none;cron.none /var/log/syslog” entry which is done using directive $IncludeConfig /etc/rsyslog.d/*.conf in /etc/rsyslog.conf.
Be sure you replace server-name below with the name of your central logging server.


# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

# log each machine to own rsyslog directory
$template TmplAuth, "/var/log/rsyslog/%HOSTNAME%/%PROGRAMNAME%.log"
$template TmplMsg, "/var/log/rsyslog/%HOSTNAME%/%PROGRAMNAME%.log"
  authpriv.*   ?TmplAuth
  *.info,mail.none,authpriv.none,cron.none   ?TmplMsg

if ($hostname != 'server-name') then TmplAuth
if ($hostname != 'server-name') then TmplMsg

& ~

Comment out end of file to disable error message about missing xconsole and add mail.none not to log Postfix messages to /var/log/syslog.


# daemon.*;mail.*;\
# news.err;\
# *.=debug;*.=info;\
# *.=notice;*.=warn |/dev/xconsole

*.*;auth,authpriv.none;mail.none    -/var/log/syslog

Verify rsyslog configuration:
rsyslogd -f /etc/rsyslog.conf -N9
You should receive message below otherwise check your log for error messages.

rsyslogd: End of config validation run. Bye.

Restart rsyslog daemon:
service rsyslog restart


#insert right after first line
#to rotate logs from remote syslog


Add following line at end of the file.

*.*   @home-server:514

service rsyslog restart

List of clients