Typically when you get your server (Cloud or Dedicated server) you’ll have access to the root user with no other additional users added to the server. 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. Also, you typically would not give just anyone root access to your server, but what if you needed to give someone access to your server? The answer to this question is to create a new user account for them. Let’s take a look at how this would be accomplished on a CentOS 7 server.
How To Create A New User In CentOS 7
Before we get started please go ahead and login to your server as the root user via SSH. If you’re not certain how to access your server using SSH, don’t you worry we’ve got you covered: Connecting to Your Server via SSH. Once you have logged into your server via SSH as the root user, please proceed to the following steps to add a new user to your server.
Step 1: Use the adduser command followed by the username you’d like to create
Step 2: Set the password for the new account using the passwd command followed by the password you’d like to use for this account
If you followed both steps successfully, the new user should now be added to your server. You can test this by issuing the su command followed by the username for the account that you just created:
su - newusernamehere
You should now be logged in as the new user! If you’d like to give this user Sudo access, please refer to the following guide starting at step 3: Create a sudo user (CentOS 7)