银河麒麟高级服务器操作系统通用rsync禁止匿名访问操作指南

news/2025/2/26 20:33:03

银河麒麟高级服务器操作系统通用rsync禁止匿名访问操作指南

      • 一 系统环境
      • 二、基础信息
        • 2.1 IP信息
        • 2.2 两台机器分别执行关闭firewalld或者放行相关的端口
      • 三、服务端配置
        • 3.1 配置rsync.conf文件
        • 3.2 创建密码文件
        • 3.3 重启rsyncd 服务
      • 四、客户端测试
        • 4.1 allowed_user1和allowed_user2用户测试
        • 4.2 其他用户测试

一 系统环境

#本文采用V10SP2进行演示

[root@localhost ~]# nkvers
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Sword)

Kernel:
4.19.90-25.35.v2101.ky10.x86_64

Build:
Kylin Linux Advanced Server
release V10 (SP2) /(Sword)-x86_64-Build09/20210524
#################################################

二、基础信息

2.1 IP信息
准备两台虚拟机,一台当做服务端,一台当做客户端
服务端IP:172.16.211.131
客户端IP:172.16.211.129
2.2 两台机器分别执行关闭firewalld或者放行相关的端口
systemctl disable firewalld --now

三、服务端配置

3.1 配置rsync.conf文件

打开 /etc/rsyncd.conf,检查所有模块配置(如 [public] 或自定义模块),确保不允许匿名访问:

以下示例是添加一个新的共享目录

[anon]
path = /path/to/anon
# 以下为关键安全配置
auth users = allowed_user1,allowed_user2  # 指定允许访问的用户列表
secrets file = /etc/rsyncd.secrets        # 指定存储用户密码的文件
read only = yes                           # 设置为 yes 时禁止写入(根据需求调整)
list = no                                 # 禁止匿名用户查看模块列表
3.2 创建密码文件

生成 /etc/rsyncd.secrets 并设置权限:

echo "allowed_user1:password1" >> /etc/rsyncd.secrets
echo "allowed_user2:password2" >> /etc/rsyncd.secrets
chmod 600 /etc/rsyncd.secrets
3.3 重启rsyncd 服务
systemctl restart rsyncd

四、客户端测试

4.1 allowed_user1和allowed_user2用户测试
[kylin@localhost ~]$ rsync rsync://allowed_user1@172.16.211.131:/anon
Password: 
@ERROR: auth failed on module anon
rsync error: error starting client-server protocol (code 5) at main.c(1659) [Receiver=3.1.3]
[kylin@localhost ~]$ rsync rsync://allowed_user1@172.16.211.131:/anon
Password: 
drwxr-xr-x             32 2025/02/25 09:14:20 .
-rw-r--r--              0 2025/02/25 09:14:18 1.txt
-rw-r--r--              0 2025/02/25 09:14:20 2.txt
[kylin@localhost ~]$ 
[kylin@localhost ~]$ 
[kylin@localhost ~]$ 
[kylin@localhost ~]$ rsync rsync://allowed_user2@172.16.211.131:/anon
Password: 
drwxr-xr-x             32 2025/02/25 09:14:20 .
-rw-r--r--              0 2025/02/25 09:14:18 1.txt
-rw-r--r--              0 2025/02/25 09:14:20 2.txt
4.2 其他用户测试
[kylin@localhost ~]$ rsync rsync://allowed_user3@172.16.211.131:/anon
Password: 
@ERROR: auth failed on module anon
rsync error: error starting client-server protocol (code 5) at main.c(1659) [Receiver=3.1.3]

经过以上测试发现,允许目录中的allowed_user1、allowed_user2用户可以正常访问,不在允许目录中的allowed_user3用户无法正常访问。


http://www.niftyadmin.cn/n/5869145.html

相关文章

火语言RPA--Excel获取Sheet页列表

【组件功能】:Excel获取Sheet页列表 配置预览 示例 获取Excel文档所有Sheet页列表 描述 分别获取F:\HuoYuYan\test.xls和F:\HuoYuYan\test.xlsx2种扩展名的sheet页列表。 配置 输出结果

贪心算法精品题

1.找钱问题 本题的贪心策略在于我们希望就可能的保留作用大的5元 class Solution { public:bool lemonadeChange(vector<int>& bills) {std::map<int ,int> _map;for(auto ch:bills){if(ch 5) _map[ch];else if(ch 10){if(_map[5] 0) return false;else{_m…

是德科技keysight N5173B信号发生器,是一款经济高效的仪器

是德科技keysight N5173B信号发生器安捷伦N5173B信号源 是德N5173B微波模拟信号发生器&#xff0c;拥有 9 kHz 至 40 GHz 的频率覆盖范围&#xff0c;N5173B为宽带滤波器、放大器、接收机等器件的参数测试提供了必要的信号&#xff0c;是一款经济高效的仪器。 N5173B特点&…

python与C系列语言的差异总结(4)

如果具有传统编译型语言的经验&#xff0c;大家可能会对是否使用字典而犹豫不决&#xff0c;担心字典的效率比列表或数组低。事实上Python字典的执行速度已经相当快了。Python语言的许多内部特性都依赖于字典&#xff0c;为提高字典的效率已经投入了大量的心血。Python的所有数…

(网络安全)如何建立安全运营中心

&#x1f345; 点击文末小卡片 &#xff0c;免费获取网络安全全套资料&#xff0c;资料在手&#xff0c;涨薪更快 虽然信息安全管理问题主要是个从上而下的问题&#xff0c;不能指望通过某一种工具来解决&#xff0c;但良好的安全技术基础架构能有效的推动和保障信息安全管理。…

联想 SR590 服务器 530-8i RAID 控制器更换损坏的硬盘

坏了的硬盘会自动亮黄灯。用一个空的新盘来替换&#xff0c;新盘最好不要有东西。但是有东西可能也没啥&#xff0c;因为我看 RAID 控制器里有格式化的选项 1. 从 IPMI 把服务器关机&#xff0c;电源键进入绿色闪烁状态 2. 断电&#xff0c;推开塑料滑块拉出支架&#xff0c;…

【Git】六、企业级开发模型

文章目录 Ⅰ. 前言Ⅱ. 系统开发环境Ⅲ. Git 分支设计规范master分支release分支develop分支feature分支hotfix分支 Ⅰ. 前言 ​ 我们知道&#xff0c;一个软件从零开始到最终交付&#xff0c;大概包括以下几个阶段&#xff1a;规划、编码、构建、测试、发布、部署和维护。 ​…

第十章:服务器消费者管理模块

目录 第一节&#xff1a;代码实现 1-1.Consumer类 1-2.QueueConsumer类 1-3.QueueConsumerManger类 第二节&#xff1a;单元测试 下期预告&#xff1a; 服务器的消费者管理模块在mqserver目录下实现。 第一节&#xff1a;代码实现 创建一个名为mq_consumer.hpp的文件&#…