...
How to add user to sudoers in debian vps
Learn how to add user to sudoers in debian vps!

This article provides a guide for how to add user to sudoers in Debian VPS.

What is Sudo?

Launch 100% ssd debian vps from $2. 49/mo!
Sudo provides users with administrator-level permissions on your Debian system without needing to know the root password, making for a safer way of working as extra privileges can be granted or removed without having to change passwords.

Configuration for Sudo privileges can be found in the /etc/sudoers file, and we will add a new user to it and give them administrator rights in this article.


Compare Debian VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/FR
US/FR
US/FR
US/FR
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
CPU: 1 Core
Memory: 2 GB
Storage: 16 GB NVMe
1 TB
KVM-SSD-8
CPU: 2 Cores
Memory: 8 GB
Storage: 128 GB NVMe
4 TB
KVM-SSD-16
CPU: 4 Cores
Memory: 16 GB
Storage: 256 GB NVMe
8 TB
KVM-SSD-32
CPU: 8 Cores
Memory: 32 GB
Storage: 512 GB NVMe
16 TB

How to Add User to Sudoers in Debian VPS

How to add user to sudoers in debian vpsSudo (short for β€œsuperuser do”) is a command-line utility that grants users administrative-level privileges on their system to run commands without needing to log in as root, making task completion safer and more secure.

To grant someone sudo privileges, they must first be added to the sudoers file. This can be accomplished in either of two ways: either adding them as members of the sudo group in system settings or by using visudo command.

To add someone to sudoers, it is first necessary to create their account.

  1. Create a New User

    The /etc/sudoers file provides rules defining which users or groups are granted sudo privileges at what levels. By default, members of the sudo group automatically obtain root access on Debian systems.

    Sudo allows a user to temporarily run commands as another user – usually root (system administrator). This is useful for tasks requiring elevated privileges or those which would otherwise be hazardous for non-administrators to complete.

    If you need to create a new user, using the adduser command is an easy and efficient way to do it. This command will create a home directory, copy files over, and configure other settings for the new account.

    1. Login to SSH as root user.
    2. Run the following command:
      adduser new-username

      where, new-username is the user to be created

    Once a user has been created, you can check if they have been added to the sudoers file by running the whoami command with root privileges. This command displays their current privileges; if β€œroot” appears as its output then you have successfully added them to sudoers file.

  2. Create a Password

    When creating a new user, you have the option of assigning that individual sudo privileges. To do so, create a password for them – when they log in they’ll be asked for their password before being granted access.

    To do this, type the following command into a terminal:

    passwd new-username

    where, new-username is the user to create a password for.

  3. Add the User to the Sudoers Group

    Sudo is a command-line utility that enables users to run commands with root privileges. To grant someone access, add them to the sudoers group quickly and easily; when using sudo they are prompted for their password before running the command; providing added protection from unintentional accessing. However, periodically review which users have sudo access in order to ensure it is still necessary and that weak passwords aren’t being utilized.

    As the first step in adding users, make sure that those you want to add belong to either the sudo or wheel groups.

    To add the new user to the Sudoers group, run the following command from the terminal as the root user:

    usermod -aG sudo new-username

    where, new-username is the user to add to sudoers.

    Once a user is part of either the sudo or wheels group, their next step should be editing /etc/sudoers file to grant them access to sudo. You can use visudo as an editor of this file.


Launch 100% ssd debian vps from $2. 49/mo!

Conclusion

You now know how to add user to sudoers in Debian VPS. For additional assistance configuring your Debian VPS from Rad Web Hosting, please contact our support team.

Read Also:

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.

One thought on β€œHow to Add User to Sudoers in Debian VPS in 3 Steps”

  1. […] A non-root user with sudo privileges (See:Β How to Add User to Sudoers in Debian VPS) […]

Comments are closed.

lg