By default a new server (Cloud or Dedicated) will come with with the root user and no additional users. Although the root user does not have any restrictions which allows you to fully manage your server, this can also be a liability from a security standpoint. Using a few simple commands you can add a new user account to your server, which will allow you to do more common tasks or grant someone more restricted access to your server. Let’s take a look at how we can add a new user in Ubuntu.
How To Create a New User in Ubuntu
Before we dive all the way in, you’ll need to login to your server via SSH. If you’re not certain how to access your server via SSH, please refer to the following guide which covers this topic in full: Connecting to Your Server via SSH. Once logged in, you can add a new user account via the following steps.
First: Use the adduser command followed by the username you’d like to create
Second: Answer the questions as they appear on your screen
Section 1: Set and confirm a password for the new user
Section 2: Enter in additional information about the new user (Optional and can be skipped by pushing enter)
Section 3: Confirm that the information you have entered is accurate by entering “y”
The new user account should now be set up and ready for use! If you’d like to give this user account Sudo access, you can do so by utilizing the information in the following guide: Create a sudo user (Ubuntu). You can test that this account was created successfully and is in working order by issuing the following command replacing “newusernamehere” with the username you just created.
su - newusernamehere
If the account was created correctly and is in working order, you should now be logged in as the new user!