0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linuxのグループ

Posted at

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?