How to Add a New User in AlmaLinux - YouTube Script

This is a YouTube script for a tutorial on how to add a new user in AlmaLinux, covering basic and advanced user creation methods, including setting passwords and adding users to groups.

Introduction (30 seconds)

Hello everyone. Welcome to my channel! Today, I will show you how to add a new user in AlmaLinux.

What We’ll Cover (20 seconds)

In this video, we’ll look at:

  • 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 with the passwd command:

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.

sudo passwd john

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)

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.

There are two ways to do this:

  1. Add the user to the wheel group after creation:
sudo usermod -aG wheel john
  1. 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 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/marketingmary -s /bin/bash -c "Mary Smith - Marketing" -G wheel 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 groups
  • mary: The username

Don’t forget to set a password:

sudo passwd mary

Verifying User Creation (1 minute)

It is time to confirm our users were created properly:

  1. We can check the user information with the id command:
id john
id mary
  1. We can also verify home directories with the ls command:
ls -la /home
  1. Check if users are in the correct groups:
grep wheel /etc/group
  1. Test sudo access (you can switch to the new user first):
su - john
sudo dnf update

Update command should run without errors.

Additional User Management Commands (45 seconds)

Here are some other useful commands for user management:

  • You can delete users with the userdel command:
sudo userdel username
  • You can delete a user and their home directory with the userdel -r option:
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)

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”