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
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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.
- Use the
useraddcommand, followed by the desired account name, to add a new user. The command below will add a new user called
# 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
# useradd testuser -d /path/to/home
- Optionally, you can now add the user to one or more groups. The following example will add our new
testuseraccount to group
# usermod -aG cdrom testuser
- 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 testuser Changing password for user testuser. New password: Retype new password: passwd: all authentication tokens updated successfully.
- We’re all done, but to retrieve user and group information to confirm that the user creation has been successful, use the
# 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.
- 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.
- 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.
- Now we see the “add user” option available in the upper right corner. Click on this option to begin adding a new user account.
- 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.
- 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.
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.