CentOS 6.4 下 sync

本文详细介绍如何在服务器端配置RSync服务,并启用匿名写入功能。同时,讲解客户端如何通过设置SELinux策略来顺利连接服务器进行文件同步,提供具体的配置文件及命令行示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1)server :    192.168.3.56

2)client:      192.168.3.57

server end:

setsebool -P allow_rsync_anon_write on
setsebool -P rsync_server on

a)

cat /etc/xinetd.d/rsync

# default: off

# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no 
flags = IPv6
socket_type     = stream
wait            = no
user            = root
server          = /usr/bin/rsync
server_args     = --daemon
log_on_failure  += USERID
}



b) cat  /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
 
 [trans_tmp]
 path = /data/trans_tmp/
 ignore errors
 read only = false
 gid = 0
 uid = 0
 list = false
 hosts allow = 118.144.155.57
 hosts deny = 0.0.0.0/32
 auth users = root
 secrets file = /etc/backserver.pas



c) cat /etc/backserver.pas
root:rootpw


d)chmod 600 /etc/backserver.pas

e)

rm /var/run/rsyncd.pid 

rsync --daemon



Client end:

a)   

vim  /etc/sysconfig/selinux  // you need to edit it if above command show error

setsebool -P allow_rsync_anon_write on

 getsebool -a |grep rsync
setsebool -P rsync_client on


b) rsync -avz --progress   --password-file <(echo rootpw)  root@192.168.3.56::trans_tmp  /data/trans_tmp/

 rsync -vzrtopg --progress   --password-file <(echo rootpw)  root@192.168.3.56::trans_tmp  /data/trans_tmp/

option explanation see below linker:

http://blog.youkuaiyun.com/xiaoxiaoniaoge/article/details/50971453





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值