first commit
This commit is contained in:
commit
ba848e218d
1001 changed files with 152333 additions and 0 deletions
71
linux基础/rsync推送数据到服务器端.md
Normal file
71
linux基础/rsync推送数据到服务器端.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
## rsync推送数据到服务器端
|
||||
服务器端:10.188.12.126 10.188.12.127
|
||||
|
||||
客户端:10.188.12.14
|
||||
|
||||
|
||||
|
||||
#### 开放873端口或者停止防火墙
|
||||
|
||||
###### 1、安装rsync,xinetd
|
||||
```
|
||||
yum -y install rsync xinetd
|
||||
```
|
||||
###### 2、服务器端配置rsync及xinetd
|
||||
|
||||
*rsync配置文件*
|
||||
```
|
||||
cat /etc/rsyncd.conf
|
||||
#全局配置
|
||||
uid = root
|
||||
gid = root
|
||||
use chroot = no
|
||||
max connections = 100
|
||||
timeout = 600
|
||||
pid file = /var/run/rsyncd.pid
|
||||
locak file = /var/run/rsyncd.lock
|
||||
log file = /var/log/rsyncd.log
|
||||
|
||||
#module
|
||||
[server]
|
||||
path = /root/test #客户端文件存放到服务器端文件的位置
|
||||
read only = no #必须为no,不然会报错:@ERROR: module is read only
|
||||
list = yes
|
||||
ignore errors
|
||||
hosts allow = 10.188.12.14
|
||||
hosts deny = *
|
||||
auth users = rsync
|
||||
secrets file = /etc/rsyncd.pass
|
||||
```
|
||||
*密码文件权限必须为600*
|
||||
```
|
||||
cat /etc/rsyncd.pass
|
||||
rsync:123456
|
||||
```
|
||||
*xinetd配置*
|
||||
```
|
||||
cat /etc/xinetd.d/rsync
|
||||
service rsync
|
||||
{
|
||||
disable = no
|
||||
flags = IPv4
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = root
|
||||
server = /usr/bin/rsync
|
||||
server_args = --daemon
|
||||
log_on_failure += USERID
|
||||
}
|
||||
```
|
||||
*启动rsync*
|
||||
```
|
||||
service xinetd restart
|
||||
```
|
||||
###### 3、客户端脚本或者命令
|
||||
|
||||
/usr/bin/rsync -azPv --password-file=/root/pass /root/Python rsync@10.188.12.127::server/
|
||||
密码文件权限必须为600
|
||||
```
|
||||
cat /root/pass
|
||||
123456
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue