How to add user on AlmaLinux

After installing AlmaLinux or migrating from CentOS to AlmaLinux, most users will eventually run into the need to do some user account management. This is especially true if you only have a root account on your system and need to setup one or more normal users.

In this guide, we’ll show you the step by step instructions to add a new user on an AlmaLinux system. This can be done through both GUI and command line. We’ll be covering both methods in this guide, so you can pick whichever option is most convenient for you.

In this tutorial you will learn:

  • How to add a new user on AlmaLinux from command line
  • How to add a new user on AlmaLinux from GNOME GUI
Adding a new user account on AlmaLinux

Adding a new user account on AlmaLinux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System AlmaLinux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to add a new user via command line



The step by step instructions below will guide you through the process of adding a new user account on AlmaLinux through the command line. You’ll need to either use the root account or run the commands with sudo.

  1. Use the useradd command, followed by the desired account name, to add a new user. The command below will add a new user called testuser.
    # useradd testuser
    

    This command will automatically create the user’s home directory at /home/testuser. To specify a different directory than the default, use the -d option.

    # useradd testuser -d /path/to/home
    
  2. Optionally, you can now add the user to one or more groups. The following example will add our new testuser account to group cdrom.
    # usermod -aG cdrom testuser
    
  3. By default, our new user account doesn’t have a password. We can still login as this user by first elevating to the root account. Plus, the user will be prompted to set a password the first time they log in. But we can also give it a password right now by using the passwd command.


    # passwd testuser
    Changing password for user testuser.
    New password: 
    Retype new password: 
    passwd: all authentication tokens updated successfully.
    
  4. We’re all done, but to retrieve user and group information to confirm that the user creation has been successful, use the id command.
    # id testuser
    uid=1001(testuser) gid=1001(testuser) groups=1001(testuser),11(cdrom)
    

How to add a new user via GNOME GUI

If you have the default GNOME GUI installed on AlmaLinux, you can use the following steps to create a new user account.

  1. Get started by opening the “Users” tab of GNOME’s settings menu. This is easiest to do by simply searching for “users” in the activities menu.
  2. Open the users settings menu

    Open the users settings menu

  3. In order to see the options we need, we’ll have to click the “unlock” button in the upper right corner. This will require you to enter your root password.


  4. Unlock the options that require administrator privileges

    Unlock the options that require administrator privileges

  5. Now we see the “add user” option available in the upper right corner. Click on this option to begin adding a new user account.
  6. Click on the add user button

    Click on the add user button

  7. Choose the new account type (standard or administrator), then fill out the user’s name, account name, and optionally set a password for the account or allow the user to set one the next time they login.


  8. Fill in all the new settings for the user and then finish adding it to the system

    Fill in all the new settings for the user and then finish adding it to the system

  9. That’s all there is to it. You can close the GNOME settings menu after you’re done, unless you want to continue using it to add more users or remove current accounts.

Closing Thoughts

In this guide, we saw how to add a new user account on AlmaLinux through command line and GNOME GUI. This is a basic task that most users will find they need to do at some point, and AlmaLinux makes the process quick and easy. We also learned how to add our new user to groups, give the account a password, create a custom home directory, and to verify information for the account.