Add and Remove Users in Linux Mint 20 - How to do it ?

When you have multiple people using a single computer, there is a serious security risk which can cause some potential issues. For example, if your family is all using a single home computer and sharing a single user account, then someone might delete someone else's file when they're trying to clear some space on the hard drive. It's also entirely possible that you don't want everyone to have the administrative powers required to perform certain actions, such as installing software.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related system tools queries on Linux Mint system.

In this context, we shall look into how you can create new users using different methods in a Linux Mint 20 system.


How to Add a New User in Linux Mint 20 ?

Before proceeding with this Configuration procedure, you will need a root or sudo privileged account.

You can apply different methods to add a new user in Linux. 


1. Adding a new user via Useradd Command

To implement this, simply Open the terminal from utilities or by pressing Ctrl+Alt+T. Use the following command to add the new user. Switch '-m' will make sure that the home directory is created for the user:

$ sudo useradd -m <username>

Note: Remember to replace <username> with the user's name.

useradd command will create the user but no password is assigned to the user so the user cannot log in. Thus you have to set the password for the user. Run the following command and provide a password when prompted:

$ sudo passwd <username>

Now that you have created the user, assign the user to a group that has desired permissions with the following command:

$ sudo usermod -a -G <groupname> <username>

Verify the assigned groups with the following command:

$ sudo groups <username>

You can further explore the usermod command option through running 'sudo usermod -h' or 'man usermod'.


2. Adding a new user via Adduser Command

To Add a user, simply execute the following command:

$ sudo adduser <username>

You will be prompted to set a password and then again to fill in user information.

The user will be added and its home directory will be built by default. You can see the full options of the adduser command through 'sudo adduser -h' or 'man adduser'.


3. Adding a new user via Settings Utility

To implement this, simply Go and open the System Settings utility. Now navigate to the Administration>Users and Groups.

You will be prompted for authentication.

After authentication, you can see all the existing users in the system. Click on Add and provide account information such as account type, name, and username.

Fill the data accordingly and press Ok to create a user.

The user will be added to the system yet the Password field is not empty. Click on the Password field.

Next, you will be prompted to change the password. Enter the password and press Change.


How to remove a User in Linux Mint 20 ?

You can remove users on Linux via different methods.

1. Removing a user via Userdel Command

To remove the user from the system, run the following command:

$ sudo userdel <username>

You can see the user is deleted but its associated home directory is still in the system. Use the '-r' switch in the command to make the home directory be deleted too:

$ sudo userdel -r <username>


2. Removing a user via Deluser Command

You can use the following deluser command to delete the user:

$ sudo deluser <username>

Add '–remove-home' option with your command to make sure the home directory reflects the changes:

$ sudo deluser --remove-home <username>

You can also see other options that are available in the deluser command by running the following command:

$ sudo deluser -h


3. Removing a user via Settings Utility

To implement this, simply Go to the Administration>Users and Groups in the System Settings Utility. You will see all the available users here. Select the user you want to remove and click on the Delete.

You will be prompted to confirm your action. Press Yes to delete the user.


[Need assistance in fixing Linux Software Installation issues ? We can help you. ]

This article covers different methods to add or delete the user in your Linux Mint system. For adding new users in system there are two commands available in your system, useradd and adduser. adduser command is the enhanced version of the useradd command. adduser command uses useradd command in the backend.

Related Posts