Table of Contents
Was this article helpful?

4  out of  4 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

Create a Sudo User on Debian

Last Updated: Thu, Sep 9, 2021
Best Practices Security System Admin


Performing server administration as a non-root user is a best practice for security. After launching your Vultr VPS, your first task as root should be to set up a non-root user with sudo access.

This guide applies to the following versions:

  • Debian 9 "Stretch"
  • Debian 10 "Buster"
  • Debian 11 "Bullseye"

1. Install sudo

Some Debian installations do not come with sudo installed. If your does not, install sudo with apt.

# apt install sudo

2. Add a New User Account

Create a new user account with the adduser command. Use a strong password for the new user. You can enter values for the user information, or press ENTER to leave those fields blank.

# adduser example_user
Adding user `example_user' ...
Adding new group `example_user' (1001) ...
Adding new user `example_user' (1001) with group `example_user' ...
Creating home directory `/home/example_user' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for example_user
Enter the new value, or press ENTER for the default
        Full Name []: Example User
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

3. Add the User to the Sudo Group

Add the new user to the sudo group.

# adduser example_user sudo

4. Test

Switch to the new user.

# su - example_user

Verify you are the new user with whoami, then test sudo access with sudo whoami, which should return root.

$ whoami
$ sudo whoami
[sudo] password for example_user:


The new user account is ready to use. As a best practice, use this sudo user for server administration. You should avoid using root for maintenance tasks.

Want to contribute?

You could earn up to $600 by adding new articles.