How to Create a Sudo User on Ubuntu

Table of Contents

How to Create a Sudo User on Ubuntu





Sudo is a program that runs on Unix-like computer operating systems that enables users to execute programs under the privileges provided by another user, usually the superuser. Sudo refers to either “substitute user do” or “super user do” either of which allows you to temporarily elevate your user account to have root privileges. This is not the same as “su”, which has a more permanent effect.







Our goal here is to walk you through setting up a sudo user on Debian,








Step 1: Configure VPSie cloud server



  1. Sign in to your system or register a newly created one by logging in to your VPSie account. 
  2. Connect by SSH using the credentials we emailed you.
  3. Once you have logged into your Ubuntu instances and update your system.




Run the command to upgrade your system,



# apt-get update && apt-get upgrade -y






Step 2: Install sudo





Installing Debian Without sudo is possible. In that case, add sudo via apt-get,




# apt install sudo





Step 3: Register for a user account





Use the adduser command to create a new user account. The user information can be filled in or left blank by pressing ENTER. A user named “testuser” will be created here.



# adduser testuser


Adding user `testuser' ...
Adding new group `testuser' (1000) ...
Adding new user `testuser' (1000) with group `testuser' ...
Creating home directory `/home/testuser' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for testuser
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] y






Step 4: Add the new user to the sudo group





Run the following command to add the user you created to the sudo group,



# usermod -aG sudo testuser






Step 5: Test the sudo





To access the newly created user, type the following command,



# su - testuser


# su - testuser
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

[email protected]:~$





That’s all for now, I hope you’ve found this informative.





Try VPSie for free today!

Share on