Inscrivez-vous maintenant pour un meilleur devis personnalisé!

How to add new users to your Linux machine

06 juin 2022 Hi-network.com
StackCommerce

Linux is a multi-user environment where numerous user accounts can be added and used like most operating systems. However, you might be surprised by how easy it is to create a new user on Linux. To illustrate this, I'm going to walk you through the steps of adding a new user with both a GUI tool and from the command line interface (CLI). Both methods are simple and can be done by anyone with just about any skill level.

recommends

The best Linux distros for beginners

Tired of Windows? Sick of paying big money for Macs? Want a better, more secure desktop? Give Linux a try.

Read now

Don't believe me? Let's get to work and find out.

I'll be demonstrating first on Ubuntu Desktop 22.04 and then Ubuntu Server 22.04, but the process is quite similar, regardless of the distribution you choose. As far as the GUI environment, every desktop does use a variation on the theme, but once you can create a user from within Ubuntu, you should be able to easily translate that to the like of KDE, Xfce and nearly any of the many Linux desktops.

Also:How to install Ubuntu Linux (It's easy!)

From the desktop

1. Open Settings

Log into Ubuntu and open the Settings tools, which can be found within the Applications Overview (Figure 1).

Figure 1

The Ubuntu Applications Overview makes it easy to locate the application you need.

Image: Jack Wallen

2. Locate Users

In the left sidebar, scroll down until use see Users (Figure 2).

Figure 2

The Users listing is found in the Ubuntu Settings app.

Image: Jack Wallen

ClickUsersand then clickUnlockso you can make changes (Figure 3).

Figure 3

Unlocking the Users section so new users can be added.

Image: Jack Wallen

3. Add a new user

ClickAdd Userat the top of the screen and then, in the resulting popup (Figure 4), fill out the information for the new user.

Figure 4

Adding a new user in Ubuntu Desktop Linux.

Image: Jack Wallen

You can then either allow the user to create their own password (they'll be prompted at first login), or you can set a password for them. If this user needs Admin privileges (so they can do things like install software), click the Administrator button, and they'll be added to the sudo group. 

ClickAdd, and the user is set for their first login.

From the command line

1. Log into your server

The first step is to log into your Linux server, either using SSH or, if you have physical access to the server, from the terminal itself. 

2. Add the new user

Once you've logged in, create a new user with the command:

sudo adduser USERNAME

Where USERNAME is the name of the user to be added. You'll be prompted to create a new password for the user, followed by full name, room number, work phone, home phone, and other. You can skip these details (although I would suggest at least adding the full name). After entering the details, you'll be prompted to OK the new user by typing Y.

3. Giving the new user admin privileges

If you've added the new user from the command line, and you want to give that user admin privileges, you must add them to the sudo group (if you're using a Red Hat-based distribution, that group is wheel). To do this, issue the command:

sudo usermod -aG sudo USERNAME

Where USERNAME is the name of the user, you just added.

4. Forcing the new user to change their password

At that point, the new user can log in with the password you set for them. If you want to force them to change their password upon first login, you could issue the command:

sudo passwd -e USERNAME

Where USERNAME is the new username you just added.

And that's all there is to add a new user in Linux, from both the GUI and the command line. As I said, once you know how to add a user from within the Ubuntu GUI, you shouldn't have much trouble doing so with any desktop. If you do run into trouble with your GUI, you can always turn to the command line option, which is universal for all Linux distributions.

Linux

The best Linux laptops for consumers and developersWant to save your aging computer? Try these 5 Linux distributionsThe best distros for beginnersHow to enable Linux on your Chromebook (and why you should)
  • The best Linux laptops for consumers and developers
  • Want to save your aging computer? Try these 5 Linux distributions
  • The best distros for beginners
  • How to enable Linux on your Chromebook (and why you should)

tag-icon Tags chauds:

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.