Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Using command line commands for group administration in AIX

News

See also

Redbooks IBM Links Recommended Links Using Smit
mkuser chuser chsh chfn lsuser passwd
chpasswd pwdadm rmuser      
Useful AIX commands smit sudo Tips Humor Etc

Now that you are familiar with the files behind the commands, take a look at the commands themselves. You'll learn how to create a user as well as modify a user after it has been created.

Like user administration, it's important that you know the configuration files behind the commands that modify them.

/etc/group

The /etc/group file contains the basics of a group. For example:

	
system:!:0:root,pconsole,esaadmin
staff:!:1:ipsec,esaadmin,sshd,xander
bin:!:2:root,bin
sys:!:3:root,bin,sys
adm:!:4:bin,adm
uucp:!:5:uucp,nuucp
mail:!:6:
security:!:7:root
cron:!:8:root
printq:!:9:lp
audit:!:10:root
ecs:!:28:
nobody:!:4294967294:nobody,lpd
perf:!:20:
shutdown:!:21:
lp:!:11:root,lp
invscout:!:12:invscout
snapp:!:13:snapp
ipsec:!:200:
pconsole:!:14:pconsole
sshd:!:201:sshd

 

As you can see, the file is colon delimited like the /etc/passwd file, and each entry contains only four fields in the following format (with spaces added before and after the delimiter to ease reading):

Group Name : Password Flag : GID : User(s)

Here's the line-by-line breakdown:

/etc/security/group

The /etc/security/group file is much like /etc/security/user for users: It contains extended attributes to the specified group:

Parameter Format Description
adms user1, user2, … Comma-delimited list of users with administrative rights to the group.
admin TRUE | FALSE If True, the group has administrative rights to the group.

For more attributes, read the man page for /etc/security/group (man group), or visit http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.files/doc/aixfiles/group.htm.

The file is broken down into stanzas like the other configuration files in /etc/security, with the group name as the identifier. A nice feature of this file is that it allows you to set administrator rights to a standard user for a group. The administrators of that group can then modify the group as they see fit by adding members to or removing members from the group. Listing 18 provides an example of what an /etc/security/group looks like. In this example, the group jradmin has admin set to False and standard users pac and xander defined as administrators of the group.

For example:
	
system:
        admin = true

staff:
        admin = false

bin:
        admin = true

sys:
        admin = true

jradmin:
        admin = false
        adms = pac,xander

A few more commands

You've read enough about the files behind the commands. Now, let's look at the commands themselves. You'll see how to create a group as well as modify it after it has been created.

mkgroup

Creating a group in AIX is simple and straightforward. The same restrictions for creating a user pertain to creating a group:

Both user and group name lengths are handled by the same parameter: v_max_logname. To view or change the value, follow the instructions provided for viewing and changing the user name length in mkuser, earlier in this article.

To create a group, simply execute the mkgroup command with the group name as an argument, as shown in in example:

	
# mkgroup atctest

# grep atctest /etc/group
atctest:!:202:

# grep -p atctest /etc/security/group
atctest:
        admin = false

To create an admin group, add the -a switch, as shown in example:

	
# mkgroup -a atcadmin

# grep atcadmin /etc/group
atcadmin:!:15:

# grep -p atcadmin /etc/security/group
atcadmin:
        admin = true

To create a group and add Xander as the administrator of the group, add the adm section of the /etc/security/group stanza to the command line, as shown in example below:

	
# mkgroup adms=xander xangroup

# grep xangroup /etc/group
xangroup:!:203:

# grep -p xangroup /etc/security/group
xangroup:
        admin = false
        adms = xander

Like mkuser, mkgroup follows the same attributes as chgroup. For a full list of the attributes, read chgroup's man page (man chgroup).

chgroup

The chgroup command works just like chuser, and its man page contains all the attributes you can change on a group. Listing 22 provides an example of how to change the group's xangroup GID from 203 to 204. Add a few users to the group, as well.

	
# grep xangroup /etc/group
xangroup:!:203:

# chgroup id=204 users=xander,atc,amdc xangroup

# grep xangroup /etc/group
xangroup:!:204:xander,atc,amdc

chgrpmem

Another way to modify a group's members is with chgrpmem. The chgrpmem command allows you to list, add, and remove users from a group as well as modify the administrators of the group.

For example, the group xangroup has xander and atc as members and xander as an administrator of the group. Remove atc from the group:

	
# chgrpmem xangroup
xangroup:
        members = xander,atc
        adms = xander

# chgrpmem -m - atc xangroup

# chgrpmem xangroup
xangroup:
        members = xander
        adms = xander

Suppose there was a mistake and user atc was not supposed to be removed. Instead, user atc was supposed to become the administrator of the group, while xander's administrative rights were to be removed. Listing 24 shows the code to make the correction.

	
# chgrpmem -m + atc xangroup

# chgrpmem -a + atc xangroup

# chgrpmem -a - xander xangroup

# chgrpmem xangroup
xangroup:
        members = xander,atc
        adms = atc

lsgroup

With such a nice command for users as lsuser, shouldn't there be one for groups, as well? There is: lsgroup. To continue with the standard format of commands and their options in AIX, lsgroup follows the same structure as lsuser.

# lsgroup xangroup
xangroup id=204 admin=false users=xander,cormany adms=cormany registry=files

# lsgroup -f xangroup
xangroup:
        id=204
        admin=false
        users=xander,cormany
        adms=cormany
        registry=files

# lsgroup -c xangroup,atcadmin
#name:id:admin:users:adms:registry
xangroup:204:false:xander,cormany:cormany:files
#name:id:admin:registry
atcadmin:15:true:files

# lsgroup -c -a id xangroup,atcadmin
#name:id
xangroup:204
#name:id
atcadmin:15

rmgroup

Throughout this article, you've been creating sample groups. Now, it's time to clean up the AIX system you're using. To remove a group from the system, simply execute rmgroup with the group's name as the argument:

# rmgroup atctest

The rmgroup command does not allow you to remove the group until you have moved all users that have the group as their primary group to another group.

Recommended Links

AIX user and group administration by Adam Cormany



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019