zoukankan      html  css  js  c++  java
  • centos7安装rsync及两台机器进行文件同步

    安装及配置

    yum -y install rsync  
    #启动rsync服务
    systemctl start rsyncd.service
    systemctl enable rsyncd.service
    
    #检查是否已经成功启动
    netstat -lnp|grep 873

    服务端配置

    # /etc/rsyncd: configuration file for rsync daemon mode
    
    # See rsyncd.conf man page for more options.
    
    # configuration example:
    
    uid = root
    gid = root
    port = 873
    use chroot = no
    # read only = no
    # list = no
    max connections = 4
    # pid file = /var/run/rsyncd.pid
    exclude = lost+found/
    transfer logging = yes
    timeout = 900
    motd file = /etc/rsyncd/rsyncd.motd
    log file = /var/log/rsyncd.log
    lock file = /var/run/rsyncd.lock
    ignore nonreadable = yes
    dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
    
    [simba]
    path = /root/************/
    comment=simba
    ignore errors
    read only = no
    write only = no
    list = no
    auth users = root
    secrets file = /etc/rsyncd.pass
    hosts allow = *

    给rsync定义身份,如下:

    echo 'root:123456'>/etc/rsyncd.passwd   //文件用户名和路径为上面定义,别写错,密码自己定
    chmod 600 /etc/rsyncd.passwd        //修改权限

    重启服务

    systemctl restart rsyncd.service

    客户端配置

    创建密码

    echo '123456' >>/etc/rsyncd-test.passwd     //注意这里只需要服务器rsyncd.passwd 中的密码
    chmod 600 /etc/rsyncd-test.passwd

    同步

    rsync -auv --password-file=/etc/rsyncd-test.passwd  /root/*********/ root@120.x.x.x::simba
  • 相关阅读:
    BZOJ2095 [Poi2010]Bridges
    BZOJ3307 雨天的尾巴
    【CSP2020】 T3 动物园
    【CSP2020】 T1儒略日
    洛谷P3455 [POI2007]ZAP-Queries
    【黑科技学习】光速幂
    XJTUOJ #1023 JM的祖传零钱箱
    XJTUOJ #1168 zxh的后宫管理系统
    XJYUOJ #1053 nocriz与队列计算机
    XJTUOJ #1017 JM的完美集合
  • 原文地址:https://www.cnblogs.com/wangbaihan/p/10734908.html
Copyright © 2011-2022 走看看