How to add user to sudo group in a Linux VPS?

With Sudo you can provide special privileges to any user or group. In Linux, there are few commands which can be accessible with root user only. You can authorize the required user who can run those commands with sudo. Reboot command can be run only by root user or sudo user.

Following are the steps to enable passwordless sudo for User.

  1. Login to your Linux server with root user using ssh.

  2. Let us create a user. Here, we will create test user.

    # adduser test
  3. Set Password for user test.

    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.

Add Users to Sudo Group

In Centos, there will be a group named "wheel". All the user accounts added to this group will have sudo privileges automatically. We can add our user in wheel group. This is the easiest and quick solution to provide sudo privilege.

  1. Let us check if wheel group is enabled on server.

  2. Type below command to open the configuration file.

    # sudo visudo
  3. You need to uncomment the %wheel line as per the below screen capture to enable wheel group.

    # Allows people in group wheel to run all commands
    %wheel ALL=(ALL) ALL
  4. Add user test to wheel group.

    # usermod -aG wheel test
  5. To verify the new user with sudo privileges, login with the test user and run the below command.

    # sudo whoami

          It should provide the below output if user is added with sudo privilege, it will provide the below output.

# Output
root

          This is how you can provide sudo privilege to any of the users in Centos.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to Install SHOUTCast Radio Server on Linux VPS?

This tutorial will assist you to install SHOUTcast Distributed Network Audio Server (DNAS 2.0) in...

How to set File Upload Size limit in Apache?

As we know Apache is an open-source and free web server. Here, we will configure apache to set...

Can I open APN port 2195 on my VPS?

You will get full administrative control of your VPS, therefore you can surely open/close any...

How to install ISPConfig on Ubuntu 18.04?

This article will help you on how to install ISPConfig on Ubuntu 18.04. ISPConfig is an open...

How to install Dotnet Core on Centos 7 ?

Dotnet Core is now available with the Linux OS. Following are the steps to install Dotnet Core on...