How to add users in Ubuntu

Ubuntu is a Linux-based operating system that uses the Debian model to distribute it as open-source software. The administrators for Ubuntu systems routinely manage user accounts, which primarily consist of creating new accounts, deleting accounts that are no longer needed and changing the privileges of existing accounts. Adding a new user account in Ubuntu is a simple task if you have superuser privileges, commonly known as root privileges. A single command will prompt you for the information needed to create the new user account. You'll then logon with the new user name and password to ensure the account is working properly.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 5 min
RELATED PRODUCTS Linux-based VPS or dedicated servers

Here is a quick tutorial on how to how to add users in Ubuntu.

Create the new account

Enter the following command from a terminal window to create the new account:

# sudo adduser testuser

The above command creates an account for the user testuser and uses sudo to ensure the command has the necessary root privileges.

The system will prompt you to enter the user's password and confirm it by entering the password again. You'll also be prompted for the user's name and phone numbers. The system will use default values for these fields if you press the Enter key without entering a value. Once you have entered the information correctly, press the "y" or Enter key to create the account.

Test the new account

Test the new account with the following command:

# su --login testuser

The above command uses the su command to change the current user account totestuser. The --login option makes the new shell a login shell, requiring you to provide the password. Enter the password for the testuser account when prompted.


Was This Article Helpful?
Thank You For Your Feedback
Glad we helped! Anything more we can do for you?
Sorry about that. How can we be more helpful?