ubuntu14 use rsync remote backup file

 

Server:

Ubuntu rsync installed by default, it requires changes only true in the false rsync

#sudo vim /etc/default/rsync
RSYNC_ENABLE=true   

Create a directory user management, backup storage directory, authorized

# useradd rsync -M -s /sbin/nologin
# mkdir /backup
# chown -R rsync.rsync /backup

Creating account password authentication and authorization

# echo "auth_rsync:123qwe" >>/etc/rsync.password
# Chmod  600 /etc/rsync.password

Edit Profile

# vim /etc/rsyncd.conf 
uid=rsync
# Just the new user management
gid=rsync
use chroot=no
# Security mechanisms, off by default
max connections=200
# Maximum number of connections
timeout=300
#overtime time
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
log file=/var/log/rsyncd.log
# Set pid, lock, log directory

[Budget]
# Module name
comment=git backup
# Remarks
path=/backup
# Backup storage directory
ignore errors
# Ignore errors
read only=false
# Off by default, if you want to stop the backup is modified to true
fake super=yes
# Parameters - A transport will complain, do not use this parameter error
#rsync: chgrp ".2.txt.hp7Mew" (in bagit) failed: Operation not permitted 
list=false
# Whether the list module list information, off by default
hosts allow=10.20.0.0/255.255.0.0
#whitelist
hosts deny=all
# Blacklist, white list when the priority whitelist
auth users=auth_rsync
# Client connections use authentication account (profile configuration can be, without creating a user)
secrets file=/etc/rsync.password
# Account password authentication directory

 Start Service

# rsync --daemon
# netstat -lnp | grep rsync
tcp    0  0 0.0.0.0:873     0.0.0.0:*               LISTEN      1170/rsync      
tcp6   0  0 :::873        :::*                    LISTEN      1170/rsync      
# killall rsync
# Kill Service

Client:

See if there install rsync

# dpkg -l | grep rsync
ii  rsync                            3.1.0-2ubuntu0.4                           amd64

Create a connection password and authorization

# echo "123qwe" >>/etc/rsync.password
# Chmod  600 /etc/rsync.password

Client Test:

# rsync -azvhnp /home/ [email protected]::bagit --password-file=/etc/rsync.password >>/var/log/rsync_client.log

# -A recursively transfer files and maintain file attributes, equivalent -rlptgoD does not include -H -r subdirectories recursively processing mode -l file -H symbolic links remain to keep hard-linked files remain -t -p to keep file permissions file -g file attribution information holding time information group holding -o file -D home subscriber information holding device and a special file in the file is compressed -z -partial-progress-v, equivalent to the processing for file transfers -p - verbose output Details mode -h, - human-readable output file size -n, - dry-run display those files to be transmitted --password-file = fILE read password designated from the fILE, enter a password in the terminal to avoid

# Back catalog plus / or without the / ( / Home) there is a difference, will not add the entire directory synchronization in the past,
# Plus / rear ( / home /) synchronizes home so the contents of the directory , rather than incidental home directory

Guess you like

Origin www.cnblogs.com/dthum/p/11929092.html