{"id":6712,"date":"2017-05-08T14:31:03","date_gmt":"2017-05-08T06:31:03","guid":{"rendered":"http:\/\/rmohan.com\/?p=6712"},"modified":"2017-05-08T14:31:03","modified_gmt":"2017-05-08T06:31:03","slug":"rhel-7-rhcsa-notes-create-delete-and-modify-local-groups-and-group-memberships","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6712","title":{"rendered":"RHEL 7 \u2013 RHCSA Notes : Create, delete, and modify local groups and group memberships."},"content":{"rendered":"<p>Group administration<\/p>\n<p>\u2013 Use the groupadd command to add a new group :<\/p>\n<p># groupadd [options] group_name<br \/>\n\u2013 Use the groupmod command to modify an existing group :<\/p>\n<p># groupmod [options] group_name<br \/>\n\u2013 Use groupdel to delete the group. You can remove a group even if there are users in the group. But you can not remove the primary group of an existing user. You must remove the user before removing the group.<\/p>\n<p># groupdel group_name<br \/>\n\u2013 Use the gpasswd command to administer the groups :<\/p>\n<p># gpasswd [options] group_name<br \/>\nFor example : to add user test in group student \u2013<\/p>\n<p># gpasswd -a test student<br \/>\ngroups command<\/p>\n<p>The groups command displays the group the user belongs to. For example the user oracle as shown below belongs to multiple groups which can be displayed using the groups command :<\/p>\n<p># groups oracle<br \/>\noracle : oinstall dba asm asmdba oper<br \/>\n# grep oracle \/etc\/group<br \/>\noinstall:x:5004:oracle<br \/>\ndba:x:5005:oracle<br \/>\nasm:x:5006:oracle<br \/>\nasmdba:x:5007:oracle<br \/>\noper:x:5008:oracle<br \/>\nnewgrp command<\/p>\n<p>The newgroup command executes a new shell and changes a user\u2019s real group information. For example,<br \/>\nBefore executing newgrp command<\/p>\n<p>$ id<br \/>\nuid=5004(oracle) gid=5004(oinstall) groups=5004(oinstall),5005(dba) &#8230;<br \/>\n$ ps<br \/>\n   PID TTY          TIME CMD<br \/>\n106591 pts\/0    00:00:00 bash<br \/>\n106672 pts\/0    00:00:00 ps<br \/>\nAfter executing newgrp command<\/p>\n<p>$ newgrp dba<br \/>\nNote the gid for the user has changed to that of the student group :<\/p>\n<p>$ id<br \/>\nuid=5004(oracle) gid=5005(dba) groups=5005(dba),5004(oinstall) &#8230;<br \/>\nAlso note that a new shell has been executed.<\/p>\n<p>$ ps<br \/>\n   PID TTY          TIME CMD<br \/>\n106591 pts\/0    00:00:00 bash<br \/>\n106231 pts\/0    00:00:00 bash<br \/>\n106672 pts\/0    00:00:00 ps<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Group administration<\/p>\n<p>\u2013 Use the groupadd command to add a new group :<\/p>\n<p># groupadd [options] group_name \u2013 Use the groupmod command to modify an existing group :<\/p>\n<p># groupmod [options] group_name \u2013 Use groupdel to delete the group. You can remove a group even if there are users in the group. But you can [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6712"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6712"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6712\/revisions"}],"predecessor-version":[{"id":6713,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6712\/revisions\/6713"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}