Friday, March 25, 2016

setup rsync server for remote file copying

Rsync is a fast and extraordinarily versatile file  copying  tool. It can  copy  locally,  to or from remote host. it provide many options that we can do with file coping, and syncing between local and remote server.

1- installation
$ sudo apt-get install rsync

*** server: ***
2- create rsync directory and configuration file
$ sudo mkdir /var/www/pub
$ sudo chmod -R 777 /var/www/pub
- configuration named rsyncd.conf
    comment = public archive
    path = /var/www/pub
    use chroot = yes
    lock file = /var/lock/rsyncd
    read only = no #if you want to be read only change it to yes
    list = yes
    uid = nobody
    gid = nogroup
    strict modes = yes
    ignore errors = no
    ignore nonreadable = yes
    transfer logging = no
    timeout = 600
    refuse options = checksum dry-run
    dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

3- run rsync as the daemon
$ sudo rsync --daemon --config=rsync.conf -v

****client ***
- sync from server to client
$ rsync -r -a -v rsync:// .
- sync from client to server
$ rsync -r -a -v . rsync://

No comments:

Post a Comment