How to implement file backup under Linux

Source: Internet
Author: User
Tags rsync

This article is about how to secure a backup, here is how the master server pushes the data for backup.

One, backup server configuration rsync file vi/etc/rsyncd.conf

#工作中指定用户 (can not be specified as 0) uid = 0gid = 0# is equivalent to a black hole. Error locating use Chroot = no# How many clients are simultaneously transmitting files max connections = 200# Timeout Time timeout = 300# process number file PID fil E =/var/run/rsyncd.pid# log file Lock file =/var/run/rsync.lock# logfile log file =/var/log/rsyncd.log# Module Start # module name random up (can be multiple) [ Backup] #需要备份的目录path =/backup# indicates error ignored error ignore errors# indicates network permissions writable (local control is really writable) Read Only = false# set IP here or let not synchronize list = false# Specify the allowed network segment hosts allow = 192.168.1.0/24# The address of the Reject link, which indicates that there are no rejections. Hosts Deny = 0.0.0.0/32# things (by default) #虚拟用户auth users = rsync_backup# password files for virtual users Secrets file =/etc/rsync.password

Second, the backup server configures the virtual user's password file

[Email protected]/]# echo "rsync_backup:123456" >/etc/rsync.password[[email protected]/]# cat/etc/ rsync.passwordrsync_backup:123456 #注: Rsync_backup for Virtual user, 123456 for this virtual user's password [[email protected]/]# chmod 600/etc/ Rsync.password #为密码文件提权 for added safety

Third, the master server configures the virtual user password and tests

[[email protected] ~]#  echo  "123456"  >/etc/rsync.password[[email protected] ~]# cat /etc/ rsync.password123456  #注意: Here just write the password, remember. [[email protected] ~]# chmod 600 /etc/rsync.password[[email protected] ~]#  LL /ETC/RSYNC.PASSWORD-RW------- 1 root root 7 4 Month  22 14:32  /etc/rsync.password[[email protected] ~]# echo  "Hello itstyle" >test.txt[[email  protected] ~]# cat test.txthello itstyle[[email protected] ~]# rsync  -avz test.txt [email protected]::backup --password-file=/etc/rsync.passwordsending  incremental file listtest.txtsent 82 bytes received 27 bytes  72.67 bytes/sectotal size is 13 speedup is 0.12 

Iv. Writing scripts

VI rsync_push.sh

#!/bin/bashrsync-az/home/tomcat8 [Email Protected]::backup--password-file=/etc/rsync.password

Original address:http://www.linuxprobe.com/linux-rsync-backup.html

How to implement file backup under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.