rsync同步数据时提示password file must not be other-accessible的解决方法
rsync password file must not be other-accessible
报错解释:
这个错误信息表明rsync在使用密码文件时遇到了权限问题。rsync要求密码文件必须对于拥有其进程用户的用户和组是可读的,但不能对其他任何用户开放可读权限。
解决方法:
确认密码文件的权限设置。使用ls -l命令查看密码文件的权限。
修改密码文件的权限,确保其只对rsync服务的用户可读。通常这个用户是rsync或nobody。
使用chmod命令修改权限。例如,如果rsync以user用户身份运行,执行:
chown user:user /path/to/password/file chmod 600 /path/to/password/file
其中/path/to/password/file是密码文件的路径。
确保在修改权限后,重新启动rsync服务以使更改生效。
故障现象:
今天做rsync远程同步时,为了从备份源站点中使用免密方式同步文件,当时在发起端输入了以下命令,
[root@localhost etc]# rsync -az --delete --password-file=/etc/server.pass backuper@14.0.0.10::wwwroot /opt/
提示了如下报错:
故障排查和解决方法:
根据报错提示的英文语句进行翻译:
密码文件不能被其他用户访问。
原来是密码文件只能被属主读取和写入,不能被其他用户读取,这是不安全的!
而创建的文件默认权限是644,需要将其设为600
[root@localhost etc]# ll | grep server.pass -rw-r--r--. 1 root root 7 9月 10 16:43 server.pass
所以需要输入以下命令来设置密码文件的权限:
[root@localhost etc]# chmod 600 server.pass [root@localhost etc]# ll | grep server.pass #检查一下权限是否改变 -rw-------. 1 root root 7 9月 10 16:43 server.pass
关于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 ~]#
到此这篇关于rsync同步数据时提示password file must not be other-accessible的解决方法的文章就介绍到这了,更多相关password file must not be other-accessible内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
服务器(VPS)安装WebSite Panel面板教程(图文)
这篇文章主要为大家分享下WebsitePanel的安装方法,WebsitePanel简称WSP是微软旗下,开源免费的虚拟主机系统,需要win2008 r2环境2013-12-12X-Frame-Options头未设置 防止网页被iframe内框架调用
有时候为了防止网页被别人的网站iFrame,我们可以通过在服务器设置HTTP头部中的X-Frame-Options信息,需要的朋友可以参考下2017-03-03宝塔通过composer安装TP依赖的详细教程(宝塔服务器)
这篇文章主要介绍了宝塔通过composer安装TP依赖的详细教程(宝塔服务器),本文给大家分享问题原因分析及解决方案,需要的朋友可以参考下2023-06-06MongoDB学习笔记(六) MongoDB索引用法和效率分析
MongoDB中的索引其实类似于关系型数据库,都是为了提高查询和排序的效率的,并且实现原理也基本一致2013-07-07
最新评论