CentOS一键配置rsync服务器脚本
2014-05-07 08:30
441 查看
1、保存下面的代码为一个文件,上传到服务器端,名称为rsync.sh
2、赋予脚本权限
3、执行脚本
4、客户端同样需要安装rsync
具体配置见http://blog.csdn.net/chenyulancn/article/details/25180667
#!/bin/bash #rsync Written by zhumaohai #For more information please visit http://www.centos.bz echo "Please input the rsync username:" read username echo "Please input the rsync username password:" read password 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 = 873 #address = $serverip #uid = nobody #gid = nobody uid = root gid = root use chroot = yes read only = yes #limit access to private LANs hosts allow=$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 85,000+ per user, per sync #transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = 300 [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 600 /etc/rsyncd/rsyncd.secrets cat >/etc/rsyncd/rsyncd.motd<<EOF +++++++++++++++++++++++++++ + centos.bz rsync 2011-2012 + +++++++++++++++++++++++++++ EOF /usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf echo "/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf" >>/etc/rc.d/rc.local ps -aux | grep rsync
2、赋予脚本权限
chmod +x rsync.sh
3、执行脚本
./rsync.sh
4、客户端同样需要安装rsync
具体配置见http://blog.csdn.net/chenyulancn/article/details/25180667
相关文章推荐
- Linux ls 命令实现(简化版)
- 搭建linux系统环境
- linux配置服务器笔记
- 使用 GIT 获得Linux Kernel的代码并查看,追踪历史记录
- Linux下DNS服务器的搭建
- Linux流量控制--排队规则
- Linux流量控制--过滤器&分类
- linux下 virtualbox不能使用usb设备
- linux之磁盘管理(二)
- Linux——mysql安装及配置
- Linux系统平均负载3个数字的含义
- Linux查看端口占用情况,并强制释放占用的端口
- 嵌入式linux flash分区配置 【转】
- 嵌入式Linux学习规划
- VIM装X神器
- Linux中的文件特殊权限
- Initialize a New LDAP Directory using OpenLDAP on CentOS 5
- 如何在Linux中“快速阅读”?
- linux之磁盘管理(一)
- postfix安装milter-limit限制发件频率