How to Create User on Centos Server
In this article, we will describe how to define user creation and root rights in our Centos instance.
To connect to your instance, you need to follow the steps in the Remote Access to Your Instance article.
You can connect to your instance via
ssh -i <path/to/file.pem> <defaultusername>@<instance_public_ip>
Switch to root user to add user.
$ sudo su
Use the adduser command to add a new user to your instance.
# adduser <username>
Use the passwd command to update the new user's password.
# passwd <username>
Set the password for new user
Changing password for user <username>.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
We need to add the user to the wheel group in order to give the root rights to the new user.
# usermod -aG wheel <username>
Test sudo access on new user account :
# su <username>