z6c - personal blog about topics

Christian Müller – Letzte Änderung: 22.10.2011 23:15 Uhr

rsnapshot

Rsnapshot ist hervorragend geeignet, Bewegungsdaten, also reine Dateien sowohl zu sichern, als auch zu archivieren.

Generelle Informationen zu Rsnapshot findet man bei Ubuntuusers. Auch wenn ich selbst fast ausschliesslich Debian nutze, finde ich die Ubuntuusers Wiki Einträge sehr gelungen und informativ. Die meisten Anleitungen und Informationen können direkt auf Debian Systeme angewandt werden oder sind mit kleinen Anpassungen zu verwenden.

Als Gedankenstütze bei der Einrichtung eines Rsnapshot Instanz quer durchs Netz, findet man unter http://troy.jdmz.net/rsnapshot/ noch ein paar Hinweise, was bei Rsnapshot per SSH zu beachten ist.

Zusammengefasst:

  1. SSH Key ohne Passwort erstellen und austauschen

    ssh-keygen -t dsa -b 2048 -f /root/cron/localhost-rsnapshot-key
    
  2. Füge ans Ende von /root/.ssh/config

    Host remotehost-rsnapshot
    Hostname remotehost.example.com
    IdentityFile /root/cron/localhost-rsnapshot-key
    
  3. Berechtigungen überprüfen bzw. anpassen

    if [ ! -d ~/.ssh ]; then mkdir ~/.ssh ; chmod 700 ~/.ssh ; fi
    cd ~/.ssh/
    if [ ! -f config ]; then touch config ; chmod 600 config ; fi
    echo Host remotehost-rsnapshot >> config
    echo Hostname remotehost.example.com >> config
    echo IdentityFile /root/cron/localhost-rsnapshot-key >> config
    
  4. Zu known_hosts hinzufügen

    [root@localhost ~]# ssh remoteuser@remotehost.example.com
    The authenticity of host 'remotehost.example.com (2.3.4.5)' can't be        established.
    RSA key fingerprint is 34:c1:29:42:67:b3:8d:ad:ba:50:34:d1:ab:d5:9a:aa.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'remotehost.example.com,2.3.4.5' (RSA) to the        list of known hosts.
    remoteuser@remotehosts.example.com's password: 
    Last login: Sun Apr 9 22:21:09 2006 from localhost.example.com
    [remoteuser@remotehost ~]#
    
  5. Key einschränken, nur gewünschte Dinge tun zu dürfen authorized_keys

    from="10.1.1.1",command="/home/remoteuser/cron/validate-rsync" ssh-dss      AAAAB3Nza
    C1kc3MAAAEBAKYJenaYvMG3nHwWxKwlWLjHb77CT2hXwmC8Ap+fG8wjlaY/9t4uA        +2qx9JNorgdrWKhH
    SKHokFFlWRj+qk3q+lGHS+hsXuvta44W0yD0y0sW62wrEVegz       +JVmntxeYc0nDz5tVGfZe6ydlgomzj1
    bhfdpYe+BAwop8L             
    +EMqKLS4iSacNjoPlHsmqHMnbibn3tBqJEq2QJjEPaiYj1iP5IaCuYBhuTKQGa+oy
    H3mXEif5CKdsIKBj46B0tCy0/GC7oWcUN92QdLrUyTeRJZsTWsxKpRbMliD2pBh4oyX/        aXEf8+HZBrO...kR/FkLJ611HWIA= root@localhost.example.com
    
  6. Rsnapshot anpassen - /etc/rsnapshot.conf

    cmd_ssh /usr/bin/ssh
    ssh_args -o BatchMode=yes
    backup remoteuser@remotehost-rsnapshot:/usr/local/apache/htdocs/ remotehost/
    
  7. Konfiguration von Rsnapshot testen

    # rsnapshot configtest
    Syntax OK
    
  8. SSH Server Options anpassen - /etc/ssh/sshd_conf

    PermitRootLogin=no
    

    ändern in

    PermitRootLogin=forced-commands-only
    
  9. Test

    # rsnapshot hourly
    

Kommentare für diesen Artikel noch nicht freigeschaltet.

Bitte eine Email an kommentare@zentonic.org mit Betreff "Kommentare für Post 3"