Ê×ÏÈÒª°²×°rsyncÈí¼þ£¬ÕÕÀý£¬debian°²×°Èí¼þÊÇ×î¼òµ¥µÄ:
aptitude install rsync
°²×°ºóĬÈϵÄrsyncÊǹرյÄ.ÐèÒªÔÚ/etc/default/rsyncÎļþÖаÑËü´ò¿ª¡£Õâ¸öÎļþÊÇdebianÌØÓеÄÉèÖã¬Óÿª¿ØÖÆrsyncÊÇ·ñÔËÐÐÔÚ·þÎñģʽ£¬ºÍÅäÖ÷þÎñ¶Ë¿ÚÒѾipµØÖ·£¬ Ö»¿ª·þÎñÆ÷¶Ë(192.168.11.24)¾ÍÐÐÁË£¬¿Í»§¶Ë²»Óÿª¡£
Ö»ÐèÒªÔÚvpnµØÖ·192.168.11.24ÉÏÃ濪·ÅÕâ¸ö·þÎñ£¬¶Ë¿Ú²»ÒªÓÃĬÈϵģ¬/etc/defaule/rsyncÎļþÈçÏÂ:
RSYNC_ENABLE=true
# RSYNC_CONFIG_FILE=
RSYNC_OPTS=' --address=123.45.67.89 --port=10001 '
È»ºóÅäÖÃ192.168.11.24»úÆ÷ÉÏÃæµÄ/etc/rsyncd.conf ,ÉèÖÃÌṩµÄrsync·þÎñĿ¼,ÒÔ¼°ÄÄЩip¿ÉÒÔ·ÃÎÊ£¬Ô¶³ÌÓû§¶ÔÓ¦µÄ±¾µØÕʺš£
[home]
path = /home
comment = home directory
use chroot = true
uid = 0
gid = 0
host allow 192.168.11.2
»¹ÓÐÃÜÂëÉèÖÃÎļþ /etc/rsync.pass ,2̨»úÆ÷¶¼Ó¦¸ÃÓÐÕâÎļþ¡£
ÄÚÈÝÈçÏÂ:
username:password
Ö§´Ë£¬ÉèÖþÍÍê³ÉÁË¡£ ÔÚ192.168.11.24ÔËÐÐrsync·þÎñ¡£
/etc/init.d/rsync start
È»ºó¾Í¿ÉÒÔÔÚ 192.168.11.2ÔËÐÐÏÂÃæÕâ¸ö½Å±¾Îļþ£¬½øÐÐͬ²½¡£ ¿ÉÒÔ°ÑÕâ¸ö½Å±¾·Å½ø/etc/crontab£¬ÈÃËü¶¨Ê±½øÐвÙ×÷¡£
#!/bin/bash
rsync --progress --recursive --links --hard-links --times --verbose \
--compress --delete \ rsync://username@192.168.11.24:10001/home /home1/192.168.11.24/home \ --password-file=/etc/rsync.pass
rsync¿ÉÒÔѹËõ´«Ê䣬ҪÊÇÔÚ¾ÖÓòÍø½øÐÐͬ²½£¬¿ÉÒÔÈ¥µô--compress ¹Ø±ÕѹËõ¹¦ÄÜ¡£