Adding users in linux ubuntu

Add a new user account

You can add multiple user accounts to your computer. Give one account to each person in your household or company. Every user has their own home folder, documents, and settings.

You need administrator privileges to add user accounts.

  1. Open the Activities overview and start typing Users .
  2. Click on Users to open the panel.
  3. Press Unlock in the top right corner and type in your password when prompted.
  4. Press the + Add User. button under Other Users to add a new user account.
  5. If you want the new user to have administrative access to the computer, select Administrator for the account type. Administrators can do things like add and delete users, install software and drivers, and change the date and time.
  6. Enter the new user’s full name. The username will be filled in automatically based on the full name. If you do not like the proposed username, you can change it.
  7. You can choose to set a password for the new user, or let them set it themselves on their first login. If you choose to set the password now, you can press the icon to automatically generate a random password. To connect the user to a network domain, click Enterprise Login .
  8. Click Add . When the user has been added, Parental Controls and Language settings can be adjusted.

If you want to change the password after creating the account, select the account, Unlock the panel and press the current password status.

In the Users panel, you can click the image next to the user’s name to the right to set an image for the account. This image will be shown in the login window. The system provides some stock photos you can use, or you can select your own or take a picture with your webcam.

Источник

How to Add and Remove Users on Ubuntu 22.04

One of the most essential tasks of a system administrator is to learn the method to add and remove users on a Linux-based system such as Ubuntu 22.04. By default, when you start a new system, the access related to the root account is given to you. However, Ubuntu 22.04 system also permits you to add or remove additional unprivileged accounts for any additional users using terminal and GUI settings.

This write-up will demonstrate the procedure to add and remove users on Ubuntu 22.04 using terminal and GUI. So, let’s start!

How to add users on Ubuntu 22.04 using terminal

In the Ubuntu terminal, the process of adding users is pretty straightforward. The first thing you need to do is hit “CTRL+ALT+T” to open the terminal and then execute the “adduser” command with the name of the new user you want to create.

For instance, in our case, we are going to add a “testuser” with the help of the below-given “adduser” command:

You will be then asked to enter a new “password” for the newly created “testuser”:

Then, provide the following information related to the newly created user account if necessary and hit “y” to verify that the entered information is correct:

Читайте также:  Linux посмотреть расширение файла

In the next step, we will add the newly created “testuser” to the “sudo” group by utilizing the following “usermod” command:

Lastly, we will verify if the “testuser” is successfully added to the “sudo” group or not:

The given output states that “testuser” is now a member of sudo group:

How to remove users on Ubuntu 22.04 using terminal

In Linux-based systems such as Ubuntu 22.04, the “deluser” command is used to remove users. In this command, you have to specify the “username” as follows:

When the above-given “deluser” command is executed without any option, it will remove the “testuser”; however, the directory of the specified user account will not be deleted:

To remove the user as well as its directory from your Ubuntu 22.04 system, add the “–remove-home” option in the same “deluser” command:

Now, let’s check out the GUI method of adding and removing users on Ubuntu 22.04.

How to add users on Ubuntu 22.04 using GUI

Most of the users prefer to utilize GUI over the terminal to configure accountrelated settings? If yes, then you are at the right place! This section will teach you the procedure to add users on Ubuntu 22.04 using GUI.

For this purpose, firstly, open up the system “Settings” by searching it manually in the “Activities” menu:

In the left-side panel of the opened window, look for the “Users” in between the other categories:

Then, click on the “Unlock” button for adding users or changing settings:

Enter your system password for the authentication:

Then, click on the below-given highlighted “Add user” button:

Upon doing so, the following window will appear on the screen asking you to enter the details related to the new user account such as “Account type”, “User name”, “Full name”, “Password”. After filling the mentioned fields click on the “Add” button:

Viola! A new user named “testuser” is successfully added to the Ubuntu 22.04 system:

How to remove users on Ubuntu 22.04 using GUI

Similar to the process of adding users, you have to “Unlock” the account setting if you want to remove a specific user from your Ubuntu 22.04 system. To do so, firstly hit on the “Unlock” button and then click on the user account which you want to remove:

Type out the system password for authentication:

Scroll down through the account settings of the opened account and click on the “Remove User” button:

Now, a confirmation dialog box will ask you to confirm whether you want to delete or keep the files of the user account. Click on the “Delete Files” button to move ahead:

As you can see, the “testuser” account has been successfully removed from our system:

We have compiled the simplest method to add and remove users on Ubuntu 22.04 with the help of the terminal and GUI.

Conclusion

On Ubuntu 22.04, utilize the “$ sudo adduser username” command for the purpose of adding a user to the system. After that, you can grant “sudo” Privileges to the newly created user. Whereas, the “$ deluser username” command assists in deleting the specified users from the system. In the case of GUI, the system “Settings” has a “Users” category that offers the options related to adding and removing users. This write-up demonstrated the procedure to add and remove users from Ubuntu 22.04.

Читайте также:  Create file as user linux

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.

Источник

How to Add and Delete Users on Ubuntu 20.04

How to Add and Delete Users on Ubuntu 20.04

Adding and removing users on a Linux system is one of the most important system administration tasks to familiarize yourself with. When you create a new system, you are often only given access to the root account by default.

While running as the root user gives you complete control over a system and its users, it is also dangerous and possibly destructive. For common system administration tasks, it’s a better idea to add an unprivileged user and carry out those tasks without root privileges. You can also create additional unprivileged accounts for any other users you may have on your system. Each user on a system should have their own separate account.

For tasks that require administrator privileges, there is a tool installed on Ubuntu systems called sudo . Briefly, sudo allows you to run a command as another user, including users with administrative privileges. In this guide, you’ll learn how to create user accounts, assign sudo privileges, and delete users.

Prerequisites

To complete this tutorial, you will need access to a server running Ubuntu 20.04. Ensure that you have root access to the server and firewall enabled. To set this up, follow our Initial Server Setup Guide for Ubuntu 20.04.

Adding a User

If you are signed in as the root user, you can create a new user at any time by running the following:

If you are signed in as a non-root user who has been given sudo privileges, you can add a new user with the following command:

Either way, you will be required to respond to a series of questions:

  • Assign and confirm a password for the new user.
  • Enter any additional information about the new user. This is optional and can be skipped by pressing ENTER if you don’t wish to utilize these fields.
  • Finally, you’ll be asked to confirm that the information you provided was correct. Press Y to continue.

Your new user is now ready for use and can be logged into with the password that you entered.

If you need your new user to have administrative privileges, continue on to the next section.

Granting a User Sudo Privileges

If your new user should have the ability to execute commands with root (administrative) privileges, you will need to give the new user access to sudo . Let’s examine two approaches to this task: first, adding the user to a pre-defined sudo user group, and second, specifying privileges on a per-user basis in sudo ’s configuration.

Adding the New User to the Sudo Group

By default, sudo on Ubuntu 20.04 systems is configured to extend full privileges to any user in the sudo group.

You can view what groups your new user is in with the groups command:

By default, a new user is only in their own group because adduser creates this in addition to the user profile. A user and its own group share the same name. In order to add the user to a new group, you can use the usermod command:

The -aG option tells usermod to add the user to the listed groups.

Please note that the usermod command itself requires sudo privileges. This means that you can only add users to the sudo group if you’re signed in as the root user or as another user that has already been added as a member of the sudo group. In the latter case, you will have to precede this command with sudo , as in this example:

Читайте также:  Обновление mozilla firefox linux

Specifying Explicit User Privileges in /etc/sudoers

As an alternative to putting your user in the sudo group, you can use the visudo command, which opens a configuration file called /etc/sudoers in the system’s default editor, and explicitly specify privileges on a per-user basis.

Using visudo is the only recommended way to make changes to /etc/sudoers because it locks the file against multiple simultaneous edits and performs a validation check on its contents before overwriting the file. This helps to prevent a situation where you misconfigure sudo and cannot fix the problem because you have lost sudo privileges.

If you are currently signed in as root, run the following:

If you are signed in as a non-root user with sudo privileges, run the same command with the sudo prefix:

Traditionally, visudo opened /etc/sudoers in the vi editor, which can be confusing for inexperienced users. By default on new Ubuntu installations, visudo will use the nano text editor, which provides a more convenient and accessible text editing experience. Use the arrow keys to move the cursor, and search for the line that reads like the following:

Below this line, add the following highlighted line. Be sure to change newuser to the name of the user profile that you would like to grant sudo privileges:

root ALL=(ALL:ALL) ALL newuser ALL=(ALL:ALL) ALL 

Add a new line like this for each user that should be given full sudo privileges. When you’re finished, save and close the file by pressing CTRL + X , followed by Y , and then ENTER to confirm.

Testing Your User’s Sudo Privileges

Now your new user is able to execute commands with administrative privileges.

When signed in as the new user, you can execute commands as your regular user by typing commands as normal:

You can execute the same command with administrative privileges by typing sudo ahead of the command:

When doing this, you will be prompted to enter the password of the regular user account you are signed in as.

Deleting a User

In the event that you no longer need a user, it’s best to delete the old account.

You can delete the user itself, without deleting any of their files, by running the following command as root:

If you are signed in as another non-root user with sudo privileges, you would use the following:

If, instead, you want to delete the user’s home directory when the user is deleted, you can issue the following command as root:

If you’re running this as a non-root user with sudo privileges, you would run the same command with the sudo prefix:

If you previously configured sudo privileges for the user you deleted, you may want to remove the relevant line again:

Or use the following command if you are a non-root user with sudo privileges:

root ALL=(ALL:ALL) ALL newuser ALL=(ALL:ALL) ALL # DELETE THIS LINE 

This will prevent a new user created with the same name from being accidentally given sudo privileges.

Conclusion

You should now have a fairly good handle on how to add and remove users from your Ubuntu 20.04 system. Effective user management will allow you to separate users and give them only the access that they are required to do their job.

For more information about how to configure sudo , check out our guide on how to edit the sudoers file.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Источник

Оцените статью
Adblock
detector