rsync 免密方式远程同步文件时 password file must not be other-accessible

故障现象

今天做rsync远程同步时,为了从备份源站点中使用免密方式同步文件,当时在发起端输入了以下命令,

[root@localhost etc]# rsync -az –delete –password-file=/etc/server.pass backuper@14.0.0.10::wwwroot /opt/

提示了如下报错:

rsync 免密方式远程同步文件时 password file must not be other-accessible

故障排查和解决方法

根据报错提示的英文语句进行翻译:
密码文件不能被其他用户访问。
原来是密码文件只能被属主读取和写入,不能被其他用户读取,这是不安全的!
而创建的文件默认权限是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

文章来自互联网,只做分享使用。发布者:小俊技术分享,转转请注明出处:https://www.baoxiaoke.com/article/131838.html

(0)
上一篇 2024-06-07 18:05
下一篇 2024-06-08 06:00

联系我们

在线咨询: QQ交谈

邮件:442814395@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信