Create A New User In Linux

If you’re familiar with Linux, you’ll already know that Linux is a multiuser system and today we’ll learn how to create a new user in Linux. This shouldn’t be a very complicated article. In some more advanced operations, you may be required to create a new user. This article will be about that.

If you aren’t already aware, you have a whole lot of users on your Linux system. You have more users than just your user account and certain things can be done by certain users. You can generally use an elevated account (or sudo) to overcome those user restrictions.

There may come a time when you want to share your device with another person. So, there’s another reason to create an additional user. If you’re managing a server with multiple users, there’s another reason to create a new user in Linux. There are any number of reasons why you’d like to create a new user and we’ll go over that process today.

We’ll just be using a couple of tools today. It’s not complicated.

useradd:

The main tool we’ll be using is the useradd command. This is a tool that’s certainly installed by default on any major distro. It’s a part of the basic building blocks we use to manage Linux, so this doesn’t require any installation. You can verify that you have useradd available with the following command:

The output should be:

If you check the man page, you’ll see this:

useradd – create a new user or update default new user information

So, as our goal is to create a new user, you can see that this is the correct tool for the job. I can’t think of a better tool for the job, as it should do everything behind the scenes as well.

passwd:

We’ll also be using the passwd command. This isn’t strictly necessary, but it’s in your best interest to set a user’s password. Once again, you won’t need to install anything and the following command will confirm that:

The output should match this output:

The text alone should let you know that this is a tool for setting passwords, but you can always refer to the man page to learn more. This is how passwd is described:

passwd – change user password

As I said, you don’t have to undergo this step but it’s in your best interests, from a security standpoint, to assign passwords to users who have any access to your system. And, as you can see, this is the right tool for the job of setting a user’s password.

Create A New User In Linux:

Of course, this is done in the terminal. As a general rule, you can press CTRL + ALT + T and your default terminal should open. That’s a fairly common shortcut that I mention often. You can also find a terminal in your application menu, pretty much regardless of which desktop environment you’re using and whichever Linux you’re using.

Creating The New User:

With your terminal now open, you’ll need to use elevated privileges, and the syntax is quite simple. To create a new user in Linux, the syntax follows:

This should be lowercase as Linux doesn’t like capital letters in usernames. So, for my username, the command would look like this:

You can confirm that you’ve added the user with the following command:

For example:

With your user firmly in place, you should set a password. Let’s do that next.

Set A Password For Your New User:

You’re almost always going to want a password for your new user. That’s easily done and also requires elevated permissions. You’ll need to continue using the terminal when you want to set a new password for the user.

The syntax for setting a password for your new user is as follows:

After you authenticate, the system will have you type in the password twice. It does this to ensure you’ve not made a mistake while typing, though it could be that you’ve made the same mistake twice.

So, be careful with this step. Otherwise, you have to find some way to reset the new user and the quickest way to do that would be to delete the user and start again.

Closure:

Yeah, I guess this counts as a short article. My most recent articles have been longer than this one. This one is about the length of my earliest articles, maybe slightly longer. The site has evolved!

Anyhow, you’ve learned how to create a new user in Linux. It shouldn’t matter which distro you’re using. The kernel you’re using shouldn’t impact this at all. It shouldn’t even matter what shell you’re using, this should simply work. If you want to create a new user, this is how you do it.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Change Your Password In The Terminal

It’s considered good form to change your password once in a while. This may not be something important for you, but others may appreciate it. It may be corporate policy or regulations that make you need to change your password, or you could just be more security minded than many others. No matter what, this article tells you how.

The tool we’re using in today’s exercise is called ‘passwd‘, which is a tool to help make and manage passwords. It’s a bit complicated, but it uses something called hashing and stores a hash instead of a plain-text password.

When you login, your password is checked against the hash that was created when the password was created. This prevents people from easily reading your stored password, stored of course because there must be something to check against.

If one remembers way back to the start of this project, my goal is to put my notes online. This article is in my notes, which is why this is such a simple article. Indeed, this article should be pretty straightforward and easy to understand. I’d definitely call it a beginner-friendly article.

Change Your Password:

Like most always, you need to open your terminal. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have your terminal open, the command you’re looking for is:

If you already have a password, you’ll need to type your current password and then you’ll type the new password twice. When you logout or next need to use your password, your new password will be required. You don’t need ‘sudo’ for this, as the password you’re changing belongs to you.

Seeing as this is short, I’ll toss in another use of passwd. If you want to change the password for a different user, you just use this command:

Change the obvious to the obvious, specifically the username. This command does require ‘sudo’, because you’re changing a password that doesn’t belong to the current user.

There’s more that can be done with passwd, but those things are beyond the scope of this article. I’d expect to see some more passwd uses covered in the future, but you can get a head start by typing man passwd into your terminal and learning about the other options.

Closure:

That’s it, really. I told you that this one would be short and easy! Sure enough, it’s pretty easy. Many of my notes are regarding people who are new to Linux, but it’s still nice to get more of them online. I dare say we’re coming along nicely.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.