In this article, we will describe how to define user creation and root rights in our server with Ubuntu operating system.
To connect to your server, 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>
CODE
Switch to root user to add user.
Use the adduser command to add a new user to your instance.
# adduser <username>
CODE
Set the password for new user
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
CODE
Follow the promts to set the new user's information. You can accept the defaults to leave all of this information blank.
Changing the user information for <username>
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
CODE
We need to add the user to the sudo group in order to give the root rights to the user we created.
# usermod -aG sudo <username>
CODE
Test sudo access on new user account: