关于rsync中/etc/rsync.password的权限故障:
①客户端故障:
[root@nfs01-31 ~]# rsync -avz /backup/ rsync_backup@10.0.0.41::backup/ --password-file=/etc/rsync.password
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
[root@nfs01-31 ~]# ls -ld /etc/rsync.password
-rwxrwxrwx 1 root root 7 Sep 25 00:10 /etc/rsync.password
[root@nfs01-31 ~]#
②客户端故障:
[root@web01-8 backup]# rsync -avz /backup/ rsync_backup@10.0.0.41::backup/ --password-file=/etc/rsync.password
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
[root@web01-8 backup]#
③password file must not be other-accessible
其实这句话 就告诉我们权限有问题的了
④查看权限:
[root@web01-8 backup]# ls -ld /etc/rsync.password
-rwxrwxrwx 1 root root 7 Sep 25 00:10 /etc/rsync.password
[root@web01-8 backup]#
[root@nfs01-31 ~]# ls -ld /etc/rsync.password
-rwxrwxrwx 1 root root 7 Sep 25 00:10 /etc/rsync.password
[root@nfs01-31 ~]#
[root@backup-41 scripts]# ls -ld /etc/rsync.password
-rwxrwxrwx 1 root root 20 Sep 25 00:26 /etc/rsync.password
[root@backup-41 scripts]#
⑤修改权限:
[root@backup-41 scripts]# chmod 600 /etc/rsync.password
[root@backup-41 scripts]# ls -ld /etc/rsync.password
-rw------- 1 root root 20 Sep 25 00:26 /etc/rsync.password
[root@backup-41 scripts]#
[root@nfs01-31 ~]# ls -ld /etc/rsync.password
-rw------- 1 root root 7 Sep 25 00:10 /etc/rsync.password
[root@nfs01-31 ~]#
[root@web01-8 backup]# ls -ld /etc/rsync.password
-rw------- 1 root root 7 Sep 25 00:10 /etc/rsync.password
[root@web01-8 backup]#
⑥查看效果:
[root@web01-8 backup]# rsync -avz /backup/ rsync_backup@10.0.0.41::backup/ --password-file=/etc/rsync.password
sending incremental file list
sent 51 bytes received 8 bytes 118.00 bytes/sec
total size is 0 speedup is 0.00
[root@web01-8 backup]#
##########################################################################################################################
[root@nfs01-31 ~]# rsync -avz /backup/ rsync_backup@10.0.0.41::backup/ --password-file=/etc/rsync.password
sending incremental file list
./
sent 25 bytes received 11 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
[root@nfs01-31 ~]#
转载于:https://blog.51cto.com/jinchengzheng/1856788