基本用户管理#

本文档是 NVIDIA DGX BasePOD:部署指南,基于 NVIDIA DGX A100 系统 的一部分。

Base Command Manager (BCM) 使用其自身的 LDAP 服务来管理用户和组,它使用在头节点上运行的集中式 LDAP 数据库服务器,而不是通过 /etc/passwd 或 /etc/group 文件中的条目。可以设置外部 LDAP 服务器用于身份验证服务,以替换现有的 BCM LDAP 服务,但这不在本文档的范围之内。

本指南仅概述了基本用户管理任务,以提供一个起点。有关完整的选项和其他详细信息,请参阅 Base Command Manager 管理员手册

虽然用户管理可以在 cmsh 和 Base View 中完成,但本章中使用 cmsh。

警告

# 提示符表示您在头节点上以 root 用户身份执行的命令。% 提示符表示您在 cmsh 内执行的命令。

配置用户#

  1. 添加用户(在本例中为 userone)。

1# cmsh
2% user
3% add userone
4% set password 7adGnv0!K
5% commit
  1. userone 将在成功登录后重置密码。

1userone@basepod-head2:~$ passwd
2(current) LDAP Password:
3New password:
4Retype new password:
5passwd: password updated successfully
6userone@basepod-head2:~$
  1. 使用 show 查看用户参数和值。

 1[basepod-head2->user[userone]]% show
 2Parameter                        Value
 3-------------------------------- --------------------------------------------
 4Accounts
 5Managees
 6Name                             userone
 7Primary group                    userone
 8Revision
 9Secondary groups
10ID                               1004
11Common name                      userone
12Surname                          userone
13Group ID                         1004
14Login shell                      /bin/bash
15Home directory                   /home/ userone
16Password                         *********
17email
18Profile
19Create cmjob certificate         no
20Write ssh proxy config           no
21Shadow min                       0
22Shadow max                       999999
23Shadow warning                   7
24Inactive                         0
25Last change                      2022/10/20
26Expiration date                  2037/12/31
27Project manager                  <submode>
28Notes                            <0B>
  1. 使用 set 更改参数。

1[basepod-head2->user[userone]]% set
2commonname              expirationdate          id                      name                    profile                 shadowmax               surname
3createcmjobcertificate  groupid                 inactive                notes                   projectmanager          shadowmin               writesshproxyconfig
4email                   homedirectory           loginshell              password                revision                shadowwarning

删除用户的步骤#

此代码块将删除用户。

1# cmsh
2% user
3% remove userone
4% commit

添加 -d 选项到 remove 也会删除主目录。

将用户添加到 K8s#

要使用 K8s 服务,还必须将用户添加到 K8s 集群。

使用 cm-kubernetes-setup 添加每个 K8s 用户。

 1root@basepod-head1:~# cm-kubernetes-setup --add-user userone
 2Connecting to CMDaemon
 3Executing 10 stages
 4################### Starting execution for 'Kubernetes Setup'
 5- kubernetes
 6- docker
 7## Progress: 0
 8#### stage: kubernetes: Get Kube Cluster
 9## Progress: 10
10#### stage: kubernetes: Check Permissions User Chart
11## Progress: 20
12#### stage: kubernetes: Check User
13## Progress: 30
14#### stage: kubernetes: Check Add User
15## Progress: 40
16#### stage: kubernetes: Check Namespace Does Not Exist
17## Progress: 50
18#### stage: kubernetes: Check Cluster Admin Has No Operators
19## Progress: 60
20#### stage: kubernetes: Deploy user
21User userone created successfully!
22## Progress: 70
23#### stage: kubernetes: List Installed Operators
24## Progress: 80
25#### stage: kubernetes: Update Operator Permissions
26## Progress: 90
27#### stage: kubernetes: Log Text
28User added successfully!
29## Progress: 100
30
31Took:     00:06 min.
32Progress: 100/100
33################### Finished execution for 'Kubernetes Setup', status: completed
34
35Kubernetes Setup finished!

从 K8s 中删除用户#

要从 K8s 中删除用户 (userone),请执行此命令

1# cm-kubernetes-setup --remove-user userone

该用户将无法再使用 K8s 服务。

如果尝试使用,将显示此错误消息

1Error from server (Forbidden): nodes is forbidden: User "userone" cannot list resource "nodes" in API group "" at the cluster scope