低质量的社交,不如高质量的独处

/etc/rsyncd.conf

[root@backup ~]# cat /etc/rsyncd.conf
#Rsync server
#created by oldboy
##rsyncd.conf start##
uid = rsync
gid = rsync
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 192.168.31.0/24
hosts deny =0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password
##################################
[backup]
comment = backup server by oldboy
path = /backup

[root@backup ~]# rsync --daemon

[root@backup ~]# echo "rsync --daemon" >>/etc/rc.local
[root@backup ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
rsync --daemon
[root@backup ~]#


[root@backup ~]# ps -ef |grep rsync|grep -v grep
root 2853 1 0 00:19 ? 00:00:00 rsync --daemon
[root@backup ~]# netstat -lntup|grep rsync
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2853/rsync
tcp 0 0 :::873 :::* LISTEN 2853/rsync
[root@backup ~]# ss -lntup|grep rsync
tcp LISTEN 0 5 :::873 :::* users:(("rsync",2853,5))
tcp LISTEN 0 5 *:873 *:* users:(("rsync",2853,3))

 

[root@backup ~]# useradd rsync -s /sbin/nologin -M 

[root@backup ~]# id rsync
uid=501(rsync) gid=501(rsync) groups=501(rsync)
[root@backup ~]#

[root@backup ~]# mkdir /backup
[root@backup ~]# chown -R rsync /backup/
[root@backup ~]# ls -ld /backup/
drwxr-xr-x 2 rsync root 4096 Jun 13 00:26 /backup/
[root@backup ~]#

[root@backup ~]# [root@backup ~]# chown -R rsync /backup/

[root@backup ~]# echo "rsync_backup:oldboy" >/etc/rsync.password
[root@backup ~]# cat /etc/rsync.password
rsync_backup:oldboy
[root@backup ~]#

[root@backup ~]# ll /etc/rsync.password
-rw-r--r-- 1 root root 20 Jun 13 00:31 /etc/rsync.password
[root@backup ~]# chmod 600 /etc/rsync.password
[root@backup ~]# ll /etc/rsync.password
-rw------- 1 root root 20 Jun 13 00:31 /etc/rsync.password
[root@backup ~]#

 

 

客户端

 

[root@lamp01 ~]# echo "oldboy" >/etc/rsync.password
[root@lamp01 ~]# chmod 600 /etc/rsync.password
[root@lamp01 ~]# ll /etc/rsync.password
-rw------- 1 root root 7 Jun 13 00:47 /etc/rsync.password

[root@lamp01 ~]# cat /etc/rsync.password 

oldboy

 

[root@lamp01 ~]# rsync -avz /tmp/ rsync_backup@192.168.31.34::backup --password-file=/etc/rsync.password
sending incremental file list
./
liweiming/

sent 103 bytes received 17 bytes 240.00 bytes/sec
total size is 0 speedup is 0.00
[root@lamp01 ~]#

 

posted @ 2017-06-13 00:15  Eren.li  阅读(468)  评论(0编辑  收藏  举报
liweiming0611@163.com
等待有三大特征:
清晰的目的、努力达成的过程、充满不确定性的结果
因上努力,果上随缘
求其上,得其中;求其中,得其下;求其下,无所得