- Advertisment -
Home How To How to add new users to a Linux computer...

How to add new users to a Linux computer from the Linux Terminal

If multiple users use your computer, it is a neat idea to create multiple user accounts so that each of them can enjoy their own space and feel at home, whenever they log in next time on your computer. Most operating systems that you can find today, are multi-user operating systems and that includes Windows, Linux from Mac OS any others. Talking about Windows, it is very easy to go to the Control Panel and create a new user account and next time the user wants to log in, they can easily do that from the welcome screen on Windows computers. Logging in to your own user account is kind of the same for Linux users, as well.

- Ad-

You can simply log in to your account from the welcome screen of your Linux distribution, enter the password and get started with your new account. But creating a new user account is not the same on Linux computers as it is on Windows computers, and you have to type and execute a few Linux commands before you can eventually create a new user account. So, if you haven’t created a new account on your Linux computer ever, I am here to assist you on how you can create a new user account on your Linux computer and add it to some user group so that they can enjoy the privileges of being in that group.

So without any delay, let’s get started with how you can create a new user account on a Linux computer.

Creating a new user on Linux

Open a Linux terminal, and type in the following command, followed by hitting the enter key.

adduser 'username'

Replace username with the name of the user, without the quotes. Here I am creating a user with the name h2s. So my command will go as follows.

adduser h2s

Create user on Linux 10

After that, the user will be created, and you will have to enter a password for the new user, followed by the full name, room number, address and other details. Not all the details are mandatory though. The user creation will be successful with just the username and the password. As shown in the screenshot below, the password will not be displayed to you, when you are entering it. Once you are done with entering all the correct details, simply type ‘y’ and hit the enter key.

Create user on Linux 20

However on CentOS-based distros, after the user is created, the password can be assigned by using the following command.

passwd 'username'

Just replace username with the name of the user, as usual. For me, the command will go as follows.

passwd h2s

Simply enter the new password twice to assign it to the new user. The password will not be displayed here, as well.

Create user on Linux 25

To switch to the new user simply type in the following command.

su 'username'

For me, the command will go as follows. Just enter the password for the new user to start using the new user account created by you.

su h2s

Create user on Linux 30

You can now execute commands as the new user on the Terminal now. You will be asked to enter the password for the new user however for security reasons.

You can even log in from the welcome screen on system startup, or by logging out of the current session.

Create user on Linux 40

After a user is created, you can even add it to a user group to assign a certain set of privileges to the user, using the following command.

usermod -aG 'user-group' 'username'

So if I have a user-group ‘newgrp’ and I want to add the user h2s to the group, the respective command is as given here.

usermod -aG newgrp h2s

Create user on Linux 50

Depending upon the privileges of the current user, you might have to enter the sudo keyword before the following commands I have mentioned here.

So, that was all about how you can add users to a Linux system. You can find it handy in many situations, and you can even create multiple instances of your own user if you don’t want to mess with your user account if you are trying out something new, which you aren’t sure about. The process is almost the same on most distributions of Linux.

Hope the information was useful for you. Do you have any questions? Feel free to comment on the same below.

Sarbasish Basuhttps://www.how2shout.com/
From B.Tech (Hons.) Electronics & Instrumentation Engineer to Photography and Writing blogs; he ultimately has answers to everything. Oh, and he's also quite good in rapidly building a relationship and set up the trust; his articles are proof of that...


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

- Advertisment -

Latest Posts

Riot games finally has confirmed the Valorant Release Date

Valorant has become the biggest sensation among the competitive gamers, since the launch of the Closed Beta version. Hundreds...

Fortnite Chapter 2 Season 3 Launch Updates

Fortnite is surely one of the most loved games by Battle Royal genre lovers. With the launch of the...

Should TikTok be Banned in India or not?

This is one of the hottest questions of the moment especially in India for sure. Before we go deep...

Newgen Software reports Revenues of Rs 661 cr in FY’20, Revenues from Cloud Business up by 60%

Press Release: Speaking about the results, Mr. Diwakar Nigam, Chairman & Managing Director, Newgen Software Technologies Ltd. said –...
- Advertisement -

9 Best & Top Open source IoT Platforms To Develop the IOT Projects

The Internet of Things (IoT) is the future of technology that helps the Artificial intelligence (AI) to control and...

Technology in classrooms: What are the benefits of technology in the classroom?

Technology in classrooms is the most effective way in today's era to completely eradicate the ignorance from students life...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you