![在 FreeIPA 中,如何使用 CLI 将多个外部帐户添加到组?](https://linux22.com/image/713238/%E5%9C%A8%20FreeIPA%20%E4%B8%AD%EF%BC%8C%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20CLI%20%E5%B0%86%E5%A4%9A%E4%B8%AA%E5%A4%96%E9%83%A8%E5%B8%90%E6%88%B7%E6%B7%BB%E5%8A%A0%E5%88%B0%E7%BB%84%EF%BC%9F.png)
我尝试了多种似乎不起作用的方法,但我最终尝试使用该ipa group-add-member ...
命令将多个外部用户添加到非 POSIX 组。
笔记:这些外部用户通过与 Active Directory 环境的信任进入。
用法
$ ipa -v help group-add-member
Usage: ipa [global-options] group-add-member GROUP-NAME [options]
Add members to a group.
Options:
-h, --help show this help message and exit
--external=STR Members of a trusted domain in DOM\name or name@domain form
--all Retrieve and print all attributes from the server. Affects
command output.
--raw Print entries as stored on the server. Only affects output
format.
--no-members Suppress processing of membership attributes.
--users=STR users to add
--groups=STR groups to add
我正在尝试做什么
$ ipa -n group-add-member ad_users_external \
--external="[email protected],[email protected]"
Group name: ad_users_external
Description: External group of admins from AD
External member: S-2-3-12-1396123456-1786123456-1027123456-123456
Member of groups: ad_users
Failed members:
member user:
member group: [email protected],[email protected]: invalid 'trusted domain object': Ambiguous search, user domain was not specified
-------------------------
Number of members added 0
-------------------------
答案1
如果您查看 CLI 工具的手册页,ipa
会发现一些示例展示了如何实现这一点,尽管不是直接使用add-group-members
子命令。
手册页
ipa group-add-member bar --users={admin,foo}
Add users "admin" and "foo" to the group "bar". This approach depends on shell expansion feature.
--external
因此您需要使用花括号和逗号将用户列表传递给交换机。
例子
$ ipa -n group-add-member ad_users_external \
--external={[email protected],[email protected]}
Group name: ad_users_external
Description: External group of admins from AD
External member: S-1-5-21-1396123456-17861234567-1027123456-123456, S-1-5-21-1396123456-1786123456-1027123456-123456
Member of groups: ad_users
-------------------------
Number of members added 2
-------------------------