How to create new sudo-enabled user

After you created new VPS, usually you will only have root user in the system. It’s recommended to create a new sudo-enabled user to do things in the VPS instead of using root. To create the new user is simple and quick

# Create new user
adduser <username>
# You will be prompted to enter new password (minimum length 8 characters)

# Add the user to sudo group
usermod -aG sudo <username>

# switch to the new user
su - <username>

# test whether the user has been created correctly
whoami
# should return <username>

sudo whoami
# should return root

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *