One-click rsync server shell script configuration in CentOS

Source: Internet
Author: User
Tags rsync

One-click rsync server shell script configuration in CentOS

1. Save the following code as a file and upload it to the server named rsync. sh.

  1. #! /Bin/bash
  2. # Rsync Written by zhumaohai
  3. # For more information please visit http://www.centos.bz
  4. Echo "Please input the rsync username :"
  5. Read username
  6. Echo "Please input the rsync username password :"
  7. Read password
  8. Echo "Please input the allow ip address :"
  9. Read allowip
  10. Echo "Please input the path you want to rsync :"
  11. Read rsyncpath
  12. Echo "====================== input all completed ============ ===================="
  13. Echo "================================ install rsync ============ =================="
  14. Yum-y install rsync
  15. Useradd $ username
  16. Mkdir/etc/rsyncd
  17. Cat>/etc/rsyncd. conf <EOF
  18. # Minimal configuration file for rsync daemon
  19. # See rsync (1) and rsyncd. conf (5) man pages for help
  20. # This line is required by the/etc/init. d/rsyncd script
  21. Pid file =/var/run/rsyncd. pid
  22. Port = 873
  23. # Address = $ serverip
  24. # Uid = nobody
  25. # Gid = nobody
  26. Uid = root
  27. Gid = root
  28. Use chroot = yes
  29. Read only = yes
  30. # Limit access to private LANs
  31. Hosts allow = $ allowip
  32. Hosts deny = *
  33. Max connections = 5
  34. Motd file =/etc/rsyncd. motd
  35. # This will give you a separate log file
  36. # Log file =/var/log/rsync. log
  37. # This will log every file transferred-up to 85,000 + per user, per sync
  38. # Transfer logging = yes
  39. Log format = % t % a % m % f % B
  40. Syslog facility = local3
  41. Timeout = 300
  42. [Home]
  43. Path = $ rsyncpath
  44. List = yes
  45. Ignore errors
  46. Auth users = $ username
  47. Secrets file =/etc/rsyncd. secrets
  48. EOF
  49. Echo "$ username: $ password">/etc/rsyncd. secrets
  50. Chmod 600/etc/rsyncd. secrets
  51. Cat>/etc/rsyncd. motd <EOF
  52. ++
  53. + Centos. bz rsync 2011-2012 +
  54. ++
  55. EOF
  56. /Usr/bin/rsync -- daemon -- config =/etc/rsyncd. conf
  57. Echo "/usr/bin/rsync -- daemon -- config =/etc/rsyncd. conf">/etc/rc. d/rc. local
  58. Ps-aux | grep rsync

2. Grant the script permission

  1. Chmod + x rsync. sh

3. Execute the script

  1. ./Rsync. sh

4. The client also needs to install rsync
See http://www.centos.bz/2011/06/rsync-server-setup/ for specific configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.