Ubuntu is used by a lot of users around the world. It is the most popular Linux distribution and a lot of users prefer it for its easiness, support, and simplicity. An Ubuntu system can be used by multiple users and new users can be added in different ways via command-line interface or GUI. In this tutorial, we will learn how to create a new user account on Ubuntu? This tutorial instructions can be used for different Ubuntu releases like Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10 and all other releases as adding a new user account is a very stable action.
Create New User Account with adduser From Command Line
The adduser command is provided by all Ubuntu releases and popular Linux distributions in order to add new users from the command line interface or terminal. This command provides different options in order to set different properties for new accounts. The most practical way to add a new user with the adduser command is calling this command with the new user name. But if you are using this command as a regular user you should provide root privileges with the sudo command. But if you are root user there no need for extra command.
$ sudo adduser ali Adding user `ali' ... Adding new group `ali' (1001) ... Adding new user `ali' (1001) with group `ali' ... Creating home directory `/home/ali' ... Copying files from `/etc/skel' ... New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: password updated successfully Changing the user information for ali Enter the new value, or press ENTER for the default Full Name : Ahmet Ali Baydan Room Number : 123 Work Phone : Home Phone : Other : Is the information correct? [Y/n] y
- “New password:” line will ask new password for the user. when you type you will see nothing for security reasons. After completing typing press enter. The provided password will be checked for password security best practices and if it does not comply you will see “BAD PASSWORD: The password is shorter than 8 characters” but this does not stop the new user creation.
- “Retype new password:” line will ask the password again to prevent errors. Just type the password again and press enter.
- Following questions are optional but if you want you can provide information.
Enter the new value, or press ENTER for the default
Full Name : Ahmet Ali Baydan
Room Number : 123
Work Phone :
Home Phone :
- “Is the information correct? [Y/n] y” line will be the last step of user creation where just put y to accept and complete user creation.
Create New User Account with useradd From Command Line
The useradd command is the reverse version of the adduser command. The useradd command provides more basic usage where the provided user is created directly and there will be no extra questions about it. But the password will not set as you expect. Keep in mind that this user will not have a home directory under the /home too.
$ sudo useradd ahmet
Then you can set the password of the given user with the passwd command by providing the username like below.
$ sudo passwd ahmet New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: password updated successfully
Create New User Account with GNOME
First, we will open the Settings tool which is used to set all user and system-related settings. From the dash type “Settings” like below. In the following screen, we can see the Settings icon.
In the settings tool we will navigate to the “Users” part like below and then click to the “Unlock” button. As regular users can not add new user and in order to add new user the root privileges will be provided.
Type you user password to provide root privileges to the Settings tool in order to create new user account.
The “Add User” button will turn green after providing password with the previous step. We will click to the Add User button to open Add User screen.
In the following Add User screen we will provides the basic information like The Full Name, Username and password and then click to the “Add” button like below.
How To Delete User?
The newly added user can be deleted by using the
deluser command. The username is provided to the deluser command as a parameter to delete this user. In the following example, we delete the user “ali”.
$ userdel ali