How to Delete or Lock a User in AlmaLinux - YouTube Script

This is a YouTube script for a tutorial on how to delete or lock a user in AlmaLinux, covering user deletion, locking, and unlocking methods.

Introduction (30 seconds)

Hello everyone. Welcome to my channel! Today, I will show you how to delete or lock a user in AlmaLinux.

What We’ll Cover (20 seconds)

In this video, we’ll look at:

  • locking and unlocking user with the passwd command
  • deleting a user with the userdel command

Let’s get started!

Prerequisites (15 seconds)

For this tutorial, you’ll need:

  • A running AlmaLinux system (I’m using AlmaLinux 9)
  • Access to a terminal
  • sudo privileges to delete and lock users

Locking and Unlocking a User (1 minute)

We have two existing users: “john” and “mary”. Let’s check if they exist.

id john
id mary

Locking a User

  • To lock a user account, you can use the passwd command with the -l option:
sudo passwd -l john
su - john

Unlocking a User

  • To unlock a user account, you can use the passwd command with the -u option:
sudo passwd -u john
su - john

Basic User Deletion (1 minute)

Deleting a User without deleting Home Directory (1 minute)

  • You can delete users with the userdel command:
sudo userdel john
  • To check if the user has been deleted, you can use the id command:
id john
ls /home

As you can see, the user “john” has been deleted but the home directory still exists.

Deleting a User with Home Directory (1 minute)

  • You can delete a user and their home directory with the userdel -r option:
sudo userdel -r mary
ls /home

Conclusion (30 seconds)

If you found this tutorial helpful, please like and subscribe for more Linux administration videos. Drop any questions in the comments below!

Thanks for watching, and happy Linux administrating!

Optional Thumbnail Text Ideas

  • “Delete or Lock Users in AlmaLinux”