原创

Linux系统之间使用rsync传文件

服务端:192.168.10.1(被上传端)

客户端:192.168.10.2(上传端)

一、服务端部署

1、安装rsync

yum install rsync -y

2、配置文件

vim /etc/rsyncd.conf
uid = root
gid = root
use chroot = yes
max connections = 0
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

read only = no
write only = no
list = no

# 允许连接地址
hosts allow = 192.168.10.2/255.255.255.0
# 拒绝地址
#hosts deny = *

[nginx_log] # 文件上传路径 path = /backup/nginx_log
auth users = root # 密码存放文件 secrets file = /etc/rsyncd.password
# 保存文件后
# 编辑密码文件
vim /etc/rsyncd.passwrod # 内容如下(用户名:密码): root:123456789 # 保存退出

chmod 600 /etc/rsyncd.passwrod

# 启动rsync服务端
rsync --daemon

二、客户端执行上传文件

# 上传命令(rsync -av 文件 用户名@ip::rsync配置文件[]内容)
rsync -av nginx.access.log-20210726.gz -p root@192.168.10.1::nginx_log
# 回车后输入密码,开始上传文件






正文到此结束
评论

登录后才能发表评论 登录/注册

0评论
  • 还没有评论,快来抢沙发吧!