Steps to create a sudo user
Follow these steps to create a new user account in
Ubuntu, and give it
.
Log in to your system as the root user
Be sure to replace IP
16.32.64.128 with your server’s IP address.$ ssh root@16.32.64.128_
Create a new user account
Replace
johndoe with the username you want to create.$ adduser johndoe_ You will be prompted to set and confirm the new user password. Make sure that the password for the new account is as strong as possible.
Adding user `johndoe' ... Adding new group `johndoe' (1001) ... Adding new user `johndoe' (1001) with group `johndoe' ... Creating home directory `/home/johndoe' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Once you set the password the command will create a home directory for the user, copy several configuration files in the home directory and prompts you to set the new user’s information. If you want to leave all of this information blank just press
ENTER to accept the defaults.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] _
Add the new user to the
sudo groupBy default on
Ubuntu systems, members of the group
sudo are granted withsudo access. To add the user you created to thesudo group use theusermod command:$ usermod -aG sudo username_
Test the
sudo accessSwitch to the newly created user:
$ su - username_ Use the
sudo command to run thewhoami command:$ sudo whoami_ IF the user has
sudo access then the output of thewhoami command will be:root
You can now log in to your
Ubuntu server with this user account and use

Log in to your system as the root user
Create a new user account
Test the