Manage users and groups
Context: RHCE certification command examples.
Manage users and groups
To manage users and groups in a Red Hat Certified Engineer (RHCE) environment, you can use various commands. Here are some examples:
Creating and managing users:
useradd
: Used to create a new user account. Example:useradd john
passwd
: Sets or changes the password for a user account. Example:passwd john
usermod
: Modifies user account attributes. Example:usermod -aG wheel john
(Adds user 'john' to the 'wheel' group)
Creating and managing groups:
groupadd
: Creates a new group. Example:groupadd developers
groupmod
: Modifies group attributes. Example:groupmod -n newgroup oldgroup
(Renames the group 'oldgroup' to 'newgroup')gpasswd
: Manages group password files. Example:gpasswd -a john developers
(Adds user 'john' to the 'developers' group)
User and group information:
id
: Displays user and group information. Example:id john
(Displays information about the user 'john')groups
: Lists groups a user belongs to. Example:groups john
(Lists the groups that user 'john' is a member of)getent
: Retrieves entries from the Name Service Switch (NSS) databases, including users and groups. Example:getent group developers
(Retrieves information about the 'developers' group)
Removing users and groups:
userdel
: Deletes a user account. Example:userdel john
groupdel
: Deletes a group. Example:groupdel developers
These are just a few examples of the commands used to manage users and groups in a RHCE environment. Remember to refer to the official documentation and man pages for more detailed information about each command and its available options.