跳转到主内容

为什么在基础操作系统中将StorageGRID服务分配给随机用户名

Views:
57
Visibility:
Public
Votes:
0
Category:
storagegrid
Specialty:
esg
Last Updated:

适用场景

StorageGRID

问题解答

此行为发生在Linux和Docker之间。在容器(在本例中为StorageGRID)中、服务会绑定到只有在容器中才知道的用户名。所述容器还会绑定到UID。
 
在基础操作系统中、容器内的用户未知、但使用的服务ID相同。但是、当Docker在基础操作系统中搜索UID时、它将提取
与该特定UID关联的任何用户。例如:
 
当我们查看容器内部时,adc  服务与adc-user 绑定。
 
root@sg6060-n1:~ # ps aux | grep adc
root    33633  0.0  0.0  2248  496 ?     S   Mar30  0:00 runsv /etc/sv/adc
adc-user  33635 25.9  0.0 5869460 190620 ?    Sl  Mar30 266:33 /usr/local/adc/adc
root    927487  0.0  0.0  6372  708 pts/0   S+  15:28  0:00 grep --color=auto adc
 
当我们查找adc-user 的ID时,与容器中该用户关联的UID是1001
 
root@sg6060-n1:~ # id adc-user
uid=1001(adc-user) gid=1000(bycast) groups=1000(bycast)
 
当我们切换到基本操作系统并为adc 执行gep时,它显示adc 正在由用户1001 运行:
 
root@SG:~ # ps aux | grep adc
root    45444  0.0  0.0  2248  496 ?     S   Mar30  0:00 runsv /etc/sv/adc
1001    45446 25.9  0.0 5869460 190520 ?    Sl  Mar30 266:39 /usr/local/adc/adc
root   1201545  0.0  0.0  3240  712 pts/0   S+  15:29  0:00 grep --color=auto adc
 
在这种情况下、 基本操作系统中没有与UID1001 关联的用户、这就是为什么它仅将1001 显示 为用户的原因。但是,如果在基本操作系统端有与此UID关联的用户名(如user234,则会列出user234 。这是因为基础操作系统不知道容器中有哪些可用用户、因此它会列出与 相关UID关联的内容。

追加信息

容器中的ID可在/etc/passwd 中找到、如下所示(常见用户列表)。UID是"x "后面的第一个数字:
 
root@sg6060-n1:~ # cat /etc/passwd | grep /usr/local
adc-user:x:1001:1000::/usr/local/adc:/bin/bash
ldr-user:x:1002:1000::/usr/local/ldr:/bin/bash
cms-user:x:1003:1000::/usr/local/cms:/bin/bash
nms-user:x:1004:1000::/usr/local/nms:/bin/bash
ams-user:x:1005:1000::/usr/local/ams:/bin/bash
ssm-user:x:1006:1000::/usr/local/ssm:/bin/bash
clb-user:x:1007:1000::/usr/local/clb:/bin/bash
cmn-user:x:1008:1000::/usr/local/cmn:/bin/bash
arc-user:x:1009:1000::/usr/local/arc:/bin/bash
mgr-user:x:1011:1000::/usr/local/servermanager:/bin/bash
mgr-pass:x:1012:1000::/usr/local/servermanager:/bin/false
dds-user:x:1013:1000::/usr/local/dds:/bin/bash
cts-user:x:1016:1000::/usr/local/cts:/bin/bash
jaeger-user:x:1025:1000::/usr/local/jaeger:/bin/bash
lambda-user:x:1026:1000::/usr/local/lambda:/bin/bash
gpt-user:x:1500:1500::/usr/local/gpt:/bin/false
ams-client:x:60000:65534::/usr/local/ams:/bin/b
 
NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.