xinted结合rsync 无密码使用
1.安装
yum install -y xinetd rsync
2.配置
cat /etc/xinetd.d/rsync
# default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync { disable = no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID }
cat /etc/rsyncd.conf
uid = root git = root use chroot = no max connections = 4 strict modes = yes port = 873 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log [backup] path = /srv comment = this is test #host allow = read only = no
3.启动
/etc/init.d/xinetd start
4.使用
rsync -Rrav --delete /data/web/ IP::backup
# 注: 一定要检查selinux是不是disabled,否则不能同步
# 没有关闭selinux的报错 receiving incremental file list rsync: opendir "/." (in backup) failed: Permission denied (13) sent 28 bytes received 136 bytes 46.86 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1505) [generator=3.0.6]
修改:
# 临时更改 [root@localhost backup]# getenforce Enforcing [root@localhost backup]# setenforce 0 [root@localhost backup]# getenforce Permissive # 永久更改 在 /etc/selinux/config 文件中修改为如下: SELINUX=disabled