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.
Categories:
2 minute read
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
passwdcommand - deleting a user with the
userdelcommand
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
passwdcommand with the-loption:
sudo passwd -l john
su - john
Unlocking a User
- To unlock a user account, you can use the
passwdcommand with the-uoption:
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
userdelcommand:
sudo userdel john
- To check if the user has been deleted, you can use the
idcommand:
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 -roption:
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”
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.