How to Add a New User in AlmaLinux - YouTube Script
Categories:
4 minute read
Introduction (30 seconds)
Hello everyone, and welcome to this tutorial! Today, I will show you how to add a new user in AlmaLinux, a stable and free enterprise-grade Linux distribution that’s compatible with Red Hat Enterprise Linux.
Whether you’re setting up a new server, creating accounts for team members, or just learning Linux administration, understanding how to manage users is a fundamental skill that every system administrator should master.
What We’ll Cover (20 seconds)
In this video, we’ll go through:
- Adding a new user with the useradd command
- Setting up a password for the new user
- Adding the user to sudo group for administrative privileges
- Creating a user with a custom home directory
- And verifying that everything is set up correctly
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
- Root or sudo privileges to create new users
Basic User Creation (1 minute)
The most basic way to create a new user in AlmaLinux is using the useradd
command. Open your terminal and let’s create a user named “john”:
sudo useradd john
That’s it! The user “john” has been created with default settings. However, this account doesn’t have a password yet, so let’s set one:
sudo passwd john
You’ll be prompted to enter and confirm a new password. Once done, the user “john” can log in with the password you’ve just set.
Understanding Default Settings (45 seconds)
When you create a user with the basic useradd
command, AlmaLinux will:
- Create a home directory at /home/username
- Assign default shell (usually /bin/bash)
- Create a private group with the same name as the user
- Set default expiration settings (none by default)
If you want to see these default settings, you can check the file /etc/default/useradd
:
cat /etc/default/useradd
Adding a User to Sudo Group (1 minute)
If you want your new user to have administrative privileges, you’ll need to add them to the wheel group, which is AlmaLinux’s sudo group.
There are two ways to do this:
- Add the user to the wheel group after creation:
sudo usermod -aG wheel john
- Or create the user and add them to the wheel group in one command:
sudo useradd -G wheel john
Now “john” has sudo privileges and can run commands with administrator rights by prefixing them with sudo
.
Creating a User with Custom Settings (1 minute 30 seconds)
Let’s create another user with some custom settings:
sudo useradd -m -d /home/custom_dir -s /bin/bash -c "Mary Smith - Marketing" -G wheel,developers mary
Let’s break down what each option does:
-m
: Creates the home directory if it doesn’t exist-d /home/custom_dir
: Sets a custom home directory path-s /bin/bash
: Sets bash as the default shell-c "Mary Smith - Marketing"
: Adds a comment (usually full name or role)-G wheel,developers
: Adds the user to multiple groupsmary
: The username
Don’t forget to set a password:
sudo passwd mary
Verifying User Creation (1 minute)
Let’s confirm our users were created properly:
- Check user information:
id john
id mary
- Verify home directories:
ls -la /home
- Check if users are in the correct groups:
grep wheel /etc/group
- Test sudo access (you can switch to the new user first):
su - john
sudo whoami
If it returns “root”, then sudo is working correctly.
Additional User Management Commands (45 seconds)
Here are some other useful commands for user management:
- To modify an existing user:
sudo usermod [options] username
- To delete a user:
sudo userdel username
- To delete a user and their home directory:
sudo userdel -r username
- To lock a user account:
sudo passwd -l username
- To unlock a user account:
sudo passwd -u username
Conclusion (30 seconds)
That’s it! You now know how to create users in AlmaLinux with both basic and advanced options. User management is a crucial aspect of system administration, and these skills will help you maintain secure and well-organized Linux systems.
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
- “AlmaLinux User Management Made Easy”
- “Add Users to AlmaLinux - Complete Guide”
- “Linux User Administration for Beginners”
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.