This is part of the independent and unofficial RHCSA Exam Study Guide series providing free π€ resources to prepare for the exam.
This post covers the objectives under the section:
βMANAGE USERS AND GROUPSβ
It contains two main parts:
- Resources: with links to learn and practice for each objective.
- Cheatsheet: containing some examples of commands and actions performed in each objective (when applied).
π Resources:
CREATE, DELETE, AND MODIFY LOCAL USER ACCOUNTS
π A Complete Guide to Usage of βusermodβ command β 15 Practical Examples with Screenshots
π Linux sysadmin basics: User account management with UIDs and GIDs
π 3 basic Linux user management commands every sysadmin should know
CHANGE PASSWORDS AND ADJUST PASSWORD AGING FOR LOCAL USER ACCOUNTS
π Forcing Linux system password changes with the chage command
π How to Manage User Password Expiration and Aging in Linux
CREATE, DELETE, AND MODIFY LOCAL GROUPS AND GROUP MEMBERSHIPS
CONFIGURE SUPERUSER ACCESS
π Cheatsheet:
CREATE, DELETE, AND MODIFY LOCAL USER ACCOUNTS
lastβ‘ show a listing of last logged in users.lastbβ‘ show a listing of last unsuccessful log in/outs.lastlogβ‘ reports the most recent login of all users of a given user.whoβ‘ show who is logged in.wβ‘ show who is logged in and what they are doing.idβ‘ print real and effective user and group IDs.getent passwd | grep usr1β‘ displayusr1definitions from/etc/passwdfile.usermod -G -a db user99β‘ adddbgroup as a suplementary group touser99account.usermod -u 1010 user99β‘ change userβs UID.usermod -d /home/user-99-new -m user99β‘ change userβs home directory.useradd -s /sbin/nologin user99β‘ createuser99account with the disability of logging in.userdel -r user45β‘ remove user and itβs home directory and mail spool.
CHANGE PASSWORDS AND ADJUST PASSWORD AGING FOR LOCAL USER ACCOUNTS
passwd user1β‘ change userβs password.chage -l usr1β‘ display account aging information.chage -m 1 -M 90 usr1β‘ set minimum and maximum days before password change forusr1.chage -d 2021-12-15 usr1β‘ set the date of last password change.chage -W 10 -I 4 usr1β‘usr1passwd will warn 10 days prior to password expiration, and is set to lock the user 4 days after expiration.passwd -x 30 -n 4 -w 10 user1β‘ user 1 password expires in 30 days, cannot change at least 4 days, starts warning 10 days prior to expiration.usermod -e 2021-12-20 user1,chage -E 2022-12-15 user1β‘ set password expiration date.passwd -S user1β‘ report password status (expiration, etc).usermod -L user1,passwd -l user1β‘ lockuser1account (verify the lock at/etc/shadowfile, there must be!!prepending the password hash).Edit
PASS_MAX_DAYS 30in/etc/login.defsfile β‘ set default password expiration limit to 30 days for the whole system.
CREATE, DELETE, AND MODIFY LOCAL GROUPS AND GROUP MEMBERSHIPS
groupsβ‘ print the groups a user is in.getent group | grep dbβ‘ displaydbgroup definitions from/etc/groupfile.groupadd mktβ‘ createmktgroup.gpasswd -d user1 dbβ‘ removesuser1fromdbgroup.groupmod -g 10400 mktβ‘ change groupβs GID.groupmod -n newmkt mktβ‘ change groupβs name.groupdel mktβ‘ deletemktgroup.
CONFIGURE SUPERUSER ACCESS
visudoβ‘ edit the/etc/sudoersfile.su -l user40β‘ login asuser40.user1 ALL=(ALL) NOPASSWD: ALLβ‘ onsudoersfile gives full root access to the system without prompting for password.usermod -aG wheel user99β‘ adduser99towhellgroup which has extended privileges.sudo -l -U usr1β‘ verify if user hassudoprivileges.
Next:
(RHCSA) Manage Security
β¦or back to Red Hat Certified System Administrator (RHCSA) Exam Study Guide
Useful links & references:
Enable Sysadmin (a blog from Red Hat)
Footnotes:
- Follow me on Twitter to get more posts like this and other quick tips in your feed.
- If you have any doubts or tips about this article, Iβd appreciate knowing and discussing it via email.
- Do you have any other Linux tips? Would you like to publish that in this blog? Please send an email to all drops.
- As English is not my native language, I apologize for the errors. Corrections are welcome.
- Contact: contact [@] alldrops [.] info.




