rsync服务的安装和使用

服务器端配置:
# yum -y install xinetd

# vi /etc/xinetd.d/rsync
将如下代码

service rsync
{
disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = –daemon
log_on_failure += USERID
}
中的 disable = yes 改成 disable = no

然后启动 xinetd
# /etc/init.d/xinetd start 或 service xinetd restart
注意:如果服务器上装有防火墙记得要打开端口,默认端口是873

# vi /etc/rsyncd.conf
[download]
path=/data/download
read only=yes
uid=nobody
gid=nobody
hosts allow=*

rsync同步发送给目标服务:

rsync -vzrtopg –progress –delete /test/aaa rsync://192.168.1.1:873/data/test

其中 data 是 目标机器 rsync 服务的模块

其他不想关的命令:

查看分隔符文件指定列的值(列编号从1开始):

awk -F ^A ‘{if ($2!=0 && $3==81065 && $5==207817) print }’ xxxx.log.20140828* | wc -l

其中的 ^A 是 unicode \u0001 ,可使用 ctrl + v + a 打出来。

tcp 抓包:

tcpdump -Avvnns 0 -i any ‘host xxx.com and (((ip[2:2] – ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)’

命令返回和域名 xxx.com 交互的 tcp 数据包