Introduction
As a Linux system administrator, managing user accounts is a fundamental task. In this challenge, you will practice creating, modifying, and deleting local user accounts on a Red Hat Enterprise Linux system. This is a core skill for maintaining a secure and organized environment.
Create a New User Account
To create a new user account, you will use the useradd command. This command creates a new user account with a home directory and default shell. You will also set the user's password using the passwd command.
Tasks
- Create a new user account named
john. - Set the user's password to
password123(Ignore the BAD PASSWORD warning).
Requirements
- Use the
useraddcommand to create the account. - The user
johnmust have a home directory created at/home/john. - The user's default shell must be
/bin/bash. - Use the
passwdcommand to set the password.
Example
Upon completion, the user john will exist on the system, and their home directory /home/john will be present. You can verify the user's existence by running id john.
Modify an Existing User Account
To modify an existing user account, you will use the usermod command. This command allows you to change the user's default shell and add them to a group. You will also verify that the user's group memberships are preserved.
Tasks
- Change the default shell for the user
johnto/bin/zsh. - Add the
johnuser to thewheelgroup, which is often used for granting administrative privileges.
Requirements
- Use the
usermodcommand to perform both modifications. - The user
johnshould retain their existing group memberships when being added to thewheelgroup.
Example
After this step, checking the user's details in /etc/passwd will show /bin/zsh as their shell. Running the groups john command will show their membership in the wheel group in addition to their primary group.
Delete a User Account
To delete a user account, you will use the userdel command. This command removes the user account from the system, including their home directory and mail spool. You will also verify that the user account has been completely removed.
Tasks
- Delete the
johnuser account from the system.
Requirements
- Use the
userdelcommand to delete the account. - Ensure the user's home directory (
/home/john) and mail spool are also removed during the deletion process.
Example
Upon completion, the john user account and their home directory /home/john will be completely removed from the system. Running id john will result in an error indicating the user does not exist.
Summary
In this challenge, you have learned the fundamental skills for managing local user accounts on a Red Hat Enterprise Linux system. You practiced creating a new user with useradd, setting a password with passwd, modifying an existing user's attributes with usermod, and deleting a user along with their home directory using userdel. These commands are essential for any system administrator responsible for user management and system security.



