1、保存下面的代码为一个文件,上传到服务器端,名称为rsync.sh 复制代码代码如下: #!/bin/bash #rsync Written by zhumaohai #For more information please visit echo "Please input the rsync username:" read username echo "Please input the rsync username password:" read password echo "Please input the server ip address:" read serverip echo "Please input the allow ip address:" read allowip echo "Please input the path you want to rsync:" read rsyncpath echo "==========================input all completed========================" echo "==========================install rsync========================" yum -y install rsync useradd $username mkdir /etc/rsyncd cat >/etc/rsyncd/rsyncd.conf<<eof # Minimal configuration file for rsync daemon # See rsync(1) and rsyncd.conf(5) man pages for help # This line is required by the /etc/init.d/rsyncd script pid file = /var/run/rsyncd.pid port = address = $serverip #uid = nobody #gid = nobody uid = root gid = root use chroot = yes read only = yes #limit access to private LANs hosts allow=..1.0/...0 .0.1.0/...0 $allowip hosts deny=* max connections = 5 motd file = /etc/rsyncd/rsyncd.motd #This will give you a separate log file #log file = /var/log/rsync.log #This will log every file transferred - up to ,+ per user, per sync #transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = [$username home] path = $rsyncpath list=yes ignore errors auth users = $username secrets file = /etc/rsyncd/rsyncd.secrets eof echo "$username:$password" > /etc/rsyncd/rsyncd.secrets chmod /etc/rsyncd/rsyncd.secrets cat >/etc/rsyncd/rsyncd.motd<<eof +++++++++++++++++++++++++++ + centos.bz rsync - + +++++++++++++++++++++++++++ eof /usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf ps -aux | grep rsync 2、赋予脚本权限 复制代码代码如下: chmod +x rsync.sh 3、执行脚本 复制代码代码如下: ./rsync.sh 4、客户端同样需要安装rsync
推荐整理分享CentOS 一键配置rsync服务器脚本(centos配置yum),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:centos怎么编辑配置文件,centos配置命令,centos配置kdump,centos配置命令,centos配置rsyslog,centos配置命令,centos配置命令,centos怎么配置ssh,内容如对您有帮助,希望把文章链接给更多的朋友!
Unix/Linux 命令参考 linux命令在系统中有两种类型:内置Shell命令和Linux命令。首先介绍一个名词控制台(console),它就是我们通常见到的使用字符操作界面的人机接口,例
CentOS中将DVD作为默认yum源的设置方法 其实对于CentOSDVD来说,里面提供的软件就足以满足我们的需要了,而且DVD里的软件版本都是稳定版,下载速度还快,对于学习CentOS来说,将CentOSDVD作为
pptp及l2tp安装教程篇一安装pptp方法 该篇文章是安装pptp,下一篇将写安装l2tp。这实际是是根据记忆写的,可能在步骤或配置上会有遗漏,争取下次用虚拟机自己动手安装来试试,如有错误