拉取(服务端到客户端)
vim /etc/rsync.conf 配置文件
{ port=8730 端口
log file=/var/log/rsync.log 日志文件
pid file=/var/run/rsync.pid 进程pid
[aming] 模块名
path=/tmp/rsync 模块对应本机目录
use chroot=yes/no 是否限定在当前目录下(tmp/rsync目录下),例如软连接,不在当前目录
max connections=4 最大连接数
read only=yes/no 在目录下只读
list=yes
uid=root 属主
gid=root 属组
#auth users=aming 用户认证 以哪个账号同步
#secrets file=/ect/rs.passwd (密码文件格式: aming:123) chmod 400 权限
#hosts allow=192.168.11.190 指定IP连接 } 多个IP用空格分开
[aming1]
path=/tmp/rsync123
use chroot=yes/no
max connections=4
read only=yes/no
list=yes
uid=root
gid=root [不指定用户认证,任何用户都可以访问]
rsync --daemon 启动守护进程
拉取:
rsync -avzP --port 8730 aming@192.168.11.16::aming/1.txt ./
以8730端口将服务端的aming模块下的1.txt同步到本地当前目录
推送:
rsync -avzP --port 8730 /tmp/111 aming@192.168.11.16::aming/
以8730端口 将本地tmp/111推送到服务器端的aming模块下