Linuxのグループ復習
意外に自信がない部分。基本だけど、あんまりやることがない。
グループの追加 その1
この場合だと、プライマリグループに影響を与えず追加できる
[root@kubemgr ~]# useradd test999
[root@kubemgr ~]#
[root@kubemgr ~]#
[root@kubemgr ~]# id test999
uid=1002(test999) gid=1004(test999) groups=1004(test999)
[root@kubemgr ~]#
[root@kubemgr ~]#
[root@kubemgr ~]# usermod -aG was,ihs test999
[root@kubemgr ~]# id test999
uid=1002(test999) gid=1004(test999) groups=1004(test999),1001(was),1002(ihs)
[root@kubemgr ~]#
グループの追加 その2
プライマリーグループをきちんと入れて再度実行
[root@kubemgr ~]# useradd test998
[root@kubemgr ~]#
[root@kubemgr ~]# id test998
uid=1003(test998) gid=1005(test998) groups=1005(test998)
[root@kubemgr ~]# usermod -g test998 -G ihs,was test998
[root@kubemgr ~]#
[root@kubemgr ~]#
[root@kubemgr ~]# id test998
uid=1003(test998) gid=1005(test998) groups=1005(test998),1001(was),1002(ihs)
[root@kubemgr ~]#
[root@kubemgr ~]#
[root@kubemgr ~]# cat /etc/passwd | grep 998
cockpit-wsinstance:x:998:998:User for cockpit-ws instances:/nonexisting:/sbin/nologin
test998:x:1003:1005::/home/test998:/bin/bash
[root@kubemgr ~]#
[root@kubemgr ~]# cat /etc/group | grep test998
was:x:1001:kenken,test001,test999,test998
ihs:x:1002:kenken,test001,test999,test998
test998:x:1005:
プライマリーグループの確認方法
cat /etc/passwd
ユーザがどのグループに所属しているか確認
[root@kubemgr ~]# groups test001
test001 : test001 wheel was ihs