Linux rsync 安装 同步文件

阅读 258

1.下载地址:rsync.samba.org

服务器端:

 2. 安装

        ./configure --prefix=/usr/local/rsync

         make

        make install

3. 编辑配置文件rsyncd.conf',内容如下:

    uid = root

            gid = root

            use chroot = no

            max connections = 4

            strict modes = yes

            port = 873

            pid file = /var/run/rsyncd.pid

            lock file = /var/run/rsync.lock

            log file = /var/log/rsyncd.log

          [rsynctest]

            path = /usr/local/rsync_test

            comment = This is test

            auth users = username

            uid = root

            gid = root

            secrets file = /usr/local/rsync.user

            read only = no

            list = no

4. 编辑验证文件 rsync.user,内容如下(账号:密码):

  username:username

chmod 600 rsync.user

5. 启动 /usr/bin/rsync --daemon --config=/usr/local/rsyncd.conf

/usr/local/rsync/bin/rsync --daemon --config=/usr/local/rsync/rsyncd.conf

 查看是否启动lsof -i :873

客户端:

rsync安装同服务器端

1. 创建密码文件rsync.user,内容如下(密码)

   username

2. 启动 /usr/bin/rsync --daemon --config=/usr/local/rsyncd.conf


测试(客户端文件同步到服务器端):

rsync -avz --progress --password-file=/usr/local/rsync.user /usr/local/rsync_test/ username@xxx.xxx.xxx.xxx::rsynctest


注意:

1. rsync_test/ 如果后面包含 '/' 只同步目录下的文件和目录 否则目录的名称都同步过去

2. 哪个用户执行 password-file 就要哪个用户的权限

3. 那root用户的话只能  su www -c "command"

文章来源:网络 版权归原作者所有,如涉及知识产权问题,请权利人联系我们,我们将立即处理.
标签:
冰雪殇璃陌梦
文章 84 获得 0个赞 共 0个粉丝

推荐阅读 更多精彩内容