Show Table of Contents
3.3. 设定用户权限
默认情况下,root 用户及所有组
haclient 中的用户都可以读取/写入该集群配置文件。从 Red Hat Enteprise Linux 7.1 开始,可使用 pcs acl 命令为本地用户设定权限,以便使用访问控制列表(ACL)允许本地用户对集群配置文件的只读或读写访问。
分两步为本地用户设定权限:
- 执行
pcs acl role create...命令创建 角色,并为那个角色定义权限。 - 使用
pcs acl user create命令为用户分配您创建的角色。
以下示例步骤为名为
rouser 的本地用户提供集群配置的只读访问。
- 这个步骤要求在本地系统中有用户
rouser,同时用户rouser是组haclient的成员。#
adduser rouser#usermod -a -G haclient rouser - 使用
enable-acl集群属性启用 Pacemaker ACL。#
pcs property set enable-acl=true --force - 使用只读权限为 cib 创建名为
read-only的角色。#
pcs acl role create read-only description="Read access to cluster" read xpath /cib - 在 pcs ACL 系统中创建用户
rouser,并为那个用户分配read-only角色。#
pcs acl user create rouser read-only - 查看当前 ACL。
#
pcs aclUser: rouser Roles: read-only Role: read-only Description: Read access to cluster Permission: read xpath /cib (read-only-read)
以下示例步骤为名为
wuser 的本地用户提供集群配置的写入访问。
- 这个步骤要求在本地系统中有用户
wuser,同时用户wuser是组haclient的成员。#
adduser wuser#usermod -a -G haclient wuser - 使用
enable-acl集群属性启用 Pacemaker ACL。#
pcs property set enable-acl=true --force - 使用写入权限为 cib 创建名为
read-only的角色。#
pcs acl role create write-access description="Full access" write xpath /cib - 在 pcs ACL 系统中常见用户
wuser,并为那个用户分配write-access角色。#
pcs acl user create wuser write-access - 查看当前 ACL。
#
pcs aclUser: rouser Roles: read-only User: wuser Roles: write-access Role: read-only Description: Read access to cluster Permission: read xpath /cib (read-only-read) Role: write-access Description: Full Access Permission: write xpath /cib (write-access-write)
有关集群 ACL 的详情请查看
pcs acl 命令的帮助页面。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.