• rsync有两种常用的认证方式,另外一种则是ssh。


    rsync有两种常用的认证方式,一种为rsync-daemon方式,另外一种则是ssh。
    在一些场合,使用rsync-daemon方式会比较缺乏灵活性,ssh方式则成为首选。

    1、从本地同步到远程
    rsync -avz -e ssh /data/wwwroot/shop/upload/ root@120.24.170.210:/data/wwwroot/shop/upload 
    rsync -avz -e 'ssh -p 61124' /data/wwwroot/shop/upload/ root@120.24.170.210:/data/wwwroot/shop/upload 
    以上两种方式的区别就是远程的ssh默认端口换了

    2、从远程同步到本地
    rsync -avzP -e ssh root@114.215.191.193:/data/wwwroot/shop/upload /data/wwwroot/shop/upload/ 
    rsync -avzP -e 'ssh -p 61124' root@114.215.191.193:/data/wwwroot/shop/upload /data/wwwroot/shop/upload/

     3、*/10 * * * * rsync -ave ssh --delete --exclude=var/log /opt/otrs root@10.32.20.60:/opt/ >> /tmp/rsyncto60.log 2>&1         #工单系统

     4、rsync -ave "ssh -p 2222" --delete /var/atlassian root@10.32.0.252:/var/       #guide系统

    5、*/10 * * * *  rsync -ave "ssh -p 2222" --delete /var/www/html/zentaopms root@172.16.2.104:/var/www/html/       #禅道系统

    6、*/30 * * * *  rsync -ave "ssh -p 2222" --delete /usr/local/zabbix root@10.32.1.89:/usr/local/       #zabbix

          */30 * * * *  rsync -ave "ssh -p 2222" --delete /var/www/html/zabbix root@10.32.1.89:/var/www/html/       #zabbix web

    7、# */10 * * * * rsync -ave "ssh -p 2222" --delete /root/ufsoft/nchome root@10.32.1.112:/root/ufsoft/        #用友

     8    

    use chroot = false
    strict modes = false
    hosts allow = *
    log file = rsyncd.log
    lock file = rsyncd.lock
    gid = 0
    uid = 0

    [BAK_D]
    path = /cygdrive/D
    auth users = administrator
    secrets file = /cygdrive/C/cwrsync/rsync_db.ps
    read only = no
    list = yes
    transfer logging = yes

    [BAK_E]
    path = /cygdrive/E
    auth users = administrator
    secrets file = /cygdrive/C/cwrsync/rsync_db.ps
    read only = no
    list = yes
    transfer logging = yes

    @echo off
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/192.168.134.9 administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/ftp administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/One administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/winit administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/WinitRelease administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass
    L:cwrsynccwRsync sync.exe -avz --delete /cygdrive/E/ftp administrator@192.168.130.50::BAK_E --password-file=/cygdrive/L/cwRsync/rsyncnas.pass

            4.1)ssh-keygen

            4.2)scp -P 2222 .ssh/id_rsa.pub root@10.32.0.252:~/.ssh/

             4.3)在服务器终端下输入下面的命令

    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

               4.4) 如果远程服务器上已经存在"~/.ssh/authorized_keys"文件,那么需要编辑服务器上"~/.ssh/authorized_keys"文件,将客户端机器上的"id_rsa.pub"文件内容追加到"~/.ssh/authorized_keys"文件中。

                如果服务器上没有"~/.ssh/authorized_keys"文件,执行下面这条命令

    cp  id_rsa.pub  authorized_keys

                 即将公钥复制为authorized_keys文件

  • 相关阅读:
    深度学习中的范数
    UML描述的模型中常见关系及表示方法
    tensorflow入门:CNN for MNIST
    tensorflow 梯度下降方法小结
    tensorflow dropout实现
    tensorflow xaiver初始化
    tensorflow入门:Neural Network for mnist
    tensorflow入门:Softmax Classication
    tensorflow入门:Logistic Regression
    Monitor关键字
  • 原文地址:https://www.cnblogs.com/xianguang/p/7363780.html
Copyright © 2020-2023  润新知