centos一键安装rsync服务器脚本
根据上一篇centos搭建rsync服务器然后结合网上脚本修改来的一键安装rsync脚本,名称为install-rsync.sh.当然只有服务端的配置,客户端就要大家自己手动去配置.
#!/bin/bash #rsync Written by rocdk890 #For more information please visit https://blog.slogra.com 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 wget perl rpm -e rsync wget http://download.slogra.com/rsync-3.0.7-1.el5.rf.i386.rpm rpm -ivh rsync-3.0.7-1.el5.rf.i386.rpm 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=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.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 85,000+ per user, per sync #transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = 300 [$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 600 /etc/rsyncd/rsyncd.secrets cat >/etc/rsyncd/rsyncd.motd<<eof +++++++++++++++++++++++++++ + Yofee Packages rsync + +++++++++++++++++++++++++++ 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
chmod 700 install-rsync.sh
./install-rsync.sh或sh install-rsync.sh来执行安装.脚本不包括iptables的端口设置部分.
附件下载:
install-rsync.rar 2.03KB
评论: