The Joker's Trick

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you will apply your knowledge of Linux user account management. You'll create new user accounts, modify existing ones, and delete users. This challenge will test your understanding of the concepts learned in the "User Account Management" lab.

Achievements

You'll demonstrate your ability to use:

  • useradd - to create new users
  • passwd - to change user passwords
  • usermod - to modify user accounts
  • userdel - to delete user accounts

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux/UserandGroupManagementGroup -.-> linux/useradd("`User Adding`") linux/UserandGroupManagementGroup -.-> linux/userdel("`User Removing`") linux/UserandGroupManagementGroup -.-> linux/usermod("`User Modifying`") linux/UserandGroupManagementGroup -.-> linux/passwd("`Password Changing`") linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`") subgraph Lab Skills linux/useradd -.-> lab-270247{{"`The Joker's Trick`"}} linux/userdel -.-> lab-270247{{"`The Joker's Trick`"}} linux/usermod -.-> lab-270247{{"`The Joker's Trick`"}} linux/passwd -.-> lab-270247{{"`The Joker's Trick`"}} linux/sudo -.-> lab-270247{{"`The Joker's Trick`"}} end

Creating User Accounts

In this step, you'll create several user accounts with different specifications.

Tasks

Complete the following tasks in order:

  1. Create a user named joker.
  2. Create a user named batman with a home directory at /home/gotham.

Requirements

  • Use the useradd command for all user creations.
  • batman has a different home directory than the default.

Example

After completing these tasks, you can verify the user information like this:

sudo grep 'joker\|batman' /etc/passwd

Sample output:

joker:x:5001:5001::/home/joker:/bin/sh
batman:x:5002:5002::/home/gotham:/bin/sh

Managing User Passwords

In this step, you'll set and change passwords for users.

Tasks

Complete the following tasks:

  1. Set a password for the joker user.
  2. Change the password for the batman user.

Requirements

  • Use the passwd command for all password operations.
  • For this challenge, use simple passwords like password123.

Example

After setting the passwords, you can check the password status:

sudo passwd -S joker
sudo passwd -S batman

Sample output:

joker P 01/19/2024 0 99999 7 -1
batman P 01/19/2024 0 99999 7 -1

Modifying User Accounts

In this step, you'll modify existing user accounts.

Tasks

Complete the following tasks:

  1. Change the joker user's home directory to /home/arkham.
  2. Change the batman user's shell to /bin/bash.

Requirements

  • Use the usermod command for all modifications.

Example

After making these changes, you can verify them:

sudo grep 'joker\|batman' /etc/passwd

Sample output:

joker:x:5001:5001::/home/arkham:/bin/sh
batman:x:5002:5002::/home/gotham:/bin/bash

Deleting User Accounts

In this final step, you'll delete user accounts.

Tasks

Complete the following tasks:

  1. Delete the joker user without removing their home directory.
  2. Delete the batman user and their home directory /home/gotham.

Requirements

  • Use the userdel command for all deletions.

Example

After deleting these users, you can verify:

sudo grep 'joker\|batman' /etc/passwd
ls /home/gotham

These commands should return no results, indicating the users have been deleted.

Summary

Congratulations! You've completed the "Joker's Trick" user account management challenge. You've demonstrated your ability to:

  1. Create user accounts with various specifications
  2. Set and change user passwords
  3. Modify user account properties
  4. Delete user accounts with and without removing home directories

These skills are fundamental for Linux system administration. Keep practicing and exploring to become a Linux user management expert!

Other Linux Tutorials you may like