Linux Basics: Creating a New User

on

Quickly and easily create a new user in linux using password authentication. The useradd utility can be used for creating new users in Ubuntu, Debian, Febora, and nearly any other linux distribution.

Name your user

You can call your user whatever you’d like; simply replace mynewuser with the name of your user in the tutorial below. For example, if you have a user called Andrew Becks, you might use andrew, abecks, or something similar.

Create a new user

With sudo access, use useradd -m to create your new user. The m flag also tells linux to create to a home folder for the new user, ex: /home/mynewuser


sudo useradd -m mynewuser

Set the new user’s password

As sudo, use passwd to create a password for the new user. (You will be promoted to enter the new password twice.)

sudo passwd mynewuser

Test your user

Now that you’ve create a new user, you can attempt to connect to the server, using the credentials.

Note about password authentication

For this particular example, we’re going to allow connection with a password, instead of an SSH key. However, in most instances, I’d definitely recommend that you use an SSH key in lieu of a password. If you’re unfamiliar with the concept of SSH keys, Digital Ocean has a great primer and tutorial: How to Setup SSH Keys

 

Image: CC0 via Pexels

Leave a Reply

Your email address will not be published. Required fields are marked *