Outils pour utilisateurs

Outils du site


informatique:linux:rsync

Ceci est une ancienne révision du document !


Table des matières

Rsync

Client

Pour synchroniser les fichiers du serveur local avec le serveur distant :

rsync -lrvcpogtu /home/* root@remote:/home/*

Pour niveau block :

rsync -u --inplace --stats file.tar.gz root@127.0.0.1:/root/file-bkp.tar.gz

Pour synchroniser le partage rsync nommé ftp vers votre serveur :

rsync rsyncserver::ftp/* .

Serveur

Installer le paquetage :

apt-get install rsync

Copier le fichier de configuration :

cp /usr/share/doc/rsync/examples/rsyncd.conf /etc/rsyncd.conf

Editer le fichier /etc/rsyncd.conf et modifier selon votre besoin, exemple ci-dessous :

# sample rsyncd.conf configuration file

# GLOBAL OPTIONS

#motd file=/etc/motd
log file=/var/log/rsyncd
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
pid file=/var/run/rsyncd.pid
#syslog facility=daemon
#socket options=

# MODULE OPTIONS

[ftp]
      comment = public archive
      path = /var/www/pub
      use chroot = yes
#     max connections=10
      lock file = /var/lock/rsyncd
# the default for read only is yes...
      read only = yes
      list = yes
      uid = nobody
      gid = nogroup
#     exclude =
#     exclude from =
#     include =
#     include from =
#     auth users =
#     secrets file = /etc/rsyncd.secrets
      strict modes = yes
      
      # ici uniquement 192.168.40.197 est acceptée, toutes les autres adresses IP sont rejetées
      hosts allow = 192.168.40.197
      hosts deny = *
      ignore errors = no
      ignore nonreadable = yes

      # ici les logs sont activés
      transfer logging = yes
#     log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
      timeout = 600
      refuse options = checksum dry-run
      dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

Editer le fichier /etc/inetd.conf en ajoutant la ligne suivante :

rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

Redémarrer inetd :

/etc/init.d/openbsd-inetd reload

Pour créer des partages rsync prendre exemple sur la section [ftp] du fichier /etc/rsyncd.conf

informatique/linux/rsync.1261460965.txt.gz · Dernière modification: 2018/09/06 19:00 (modification externe)