rsync同步数据时提示password file must not be other-accessible的解决方法

 更新时间:2024年06月05日 16:52:57   作者:chengu04  
今天服务器同步数据的时候,突然有个命令提示这个错误,但其它的机器又正常,很奇怪,不过通过下面的命令执行以下就可以了,windows与linux操作方法一致

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内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • CentOS 6.3 Rsync客户端与Win2003 cwRsyncServer服务端实现数据同步

    CentOS 6.3 Rsync客户端与Win2003 cwRsyncServer服务端实现数据同步

    这篇文章主要介绍了CentOS 6.3 Rsync客户端与Win2003 cwRsyncServer服务端实现数据同步,需要的朋友可以参考下
    2015-07-07
  • Redis服务器笔记

    Redis服务器笔记

    redis是一个高性能的key-value存储系统,能够作为缓存框架和队列。下面通过本文给大家分享Redis服务器的笔记,感兴趣的朋友一起看看吧
    2017-09-09
  • 游戏服务器中的Netty应用以及源码剖析

    游戏服务器中的Netty应用以及源码剖析

    这篇文章主要为大家介绍了游戏服务器中的Netty应用以及源码剖析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2022-08-08
  • GitLab 服务器宕机时的项目代码恢复方法

    GitLab 服务器宕机时的项目代码恢复方法

    当 GitLab 服务器意外宕机且没有备份时,项目代码的恢复变得尤为关键,这篇文章主要介绍了GitLab服务器宕机时的项目代码恢复方法,需要的朋友可以参考下
    2025-04-04
  • Visual Studio Code上传文件到服务器的操作方法

    Visual Studio Code上传文件到服务器的操作方法

    在 Visual Studio Code (VS Code) 中上传文件到 Linux 系统主要通过SSH 协议实现,结合图形界面(GUI)或命令行工具操作,以下是具体说明及进度查看、断点续传的实现方法,感兴趣的朋友一起看看吧
    2025-07-07
  • HTTP-Header中常见字段及含义详解

    HTTP-Header中常见字段及含义详解

    这篇文章主要为大家介绍了HTTP-Header中常见字段及含义详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2023-11-11
  • rsync 安装使用详解

    rsync 安装使用详解

    rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync
    2013-03-03
  • aws服务器更换实例规格后ssh无法登陆的解决方案

    aws服务器更换实例规格后ssh无法登陆的解决方案

    这篇文章主要介绍了aws服务器更换实例规格后ssh无法登陆,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-07-07
  • Rsync 服务安全加固方法

    Rsync 服务安全加固方法

    Rsync 是一个通过检查文件的时间戳和大小,来跨计算机系统高效地传输和同步文件的工具,建议您在使用 Rsync 服务端时,参考本文对 Rsync 服务进行安全加固,保障数据安全
    2018-02-02
  • cwRsync提示password file must be owned by root when running as root的解决方法

    cwRsync提示password file must be owned by root when running as

    今天在配置服务器的时候,用了rsync4.10版本,客户端是2003服务器端是2008 r2 同步的时候提示password file must be owned by root when running as root问题,以前用老版本的时候没见过,还好看了下面的文章解决了,特分享下
    2015-08-08

最新评论