====== Efficient backups with rsnapshot ====== Basically, do this: http://troy.jdmz.net/rsnapshot/ Reminder: on debian/ubuntu, you need to "sudo apt-get install liblchown-perl" so rsnapshot can set symlink ownership. In place of his rickety ''validate-rsync'' script, use this ''rrsync'' script on clients: #!/usr/bin/perl # Name: /usr/local/bin/rrsync (should have a symlink in /usr/bin) # Purpose: Restricts rsync to subdirectory declared in .ssh/authorized_keys # # The client uses "rsync -av -e ssh src/ server:dir/", and sshd on the server # executes this program when .ssh/authorized_keys has 'command="..."'. # For example: # command="rrsync logs/client" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAzGhEeNlPr... # command="rrsync -ro results" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAmkHG1WCjC... # The former limits the remote client to a specific subdirectory of "logs" # and the latter allows read-only access to a different dirctory. use Socket; use constant LOGFILE => '/home/tkbletsc/rrsync.log'; my $Usage = <>',LOGFILE) { my $hhmm = sprintf "%02d:%02d",(localtime)[2,1]; my $host = $ENV{SSH_CLIENT} || 'unknown'; $host =~ s/ .*//; # Keep only the client's IP addr $host = gethostbyaddr(inet_aton($host),AF_INET) || $host; $_ = sprintf "%-13s",$host; print LOG "$hhmm $_ [$command] =",($forced ? "> $target" : ' OK'),"\n"; close LOG; } exec "$cmd $target" or die "exec($cmd $target) failed: $? $!"; # Note: This assumes that the rsync protocol will not be maliciously hijacked. For Windows targets, install cygwin's SSH and rsync as per this guide. The rsnapshot.conf lines for such hosts should look something like: backup windowsuser@windowsbox-rsnapshot:/d/Documents windowsbox/ rsync_long_args=--no-numeric-ids --delete --relative --delete-excluded