CALL 1.800.975.6814    LIVE CHAT

@dailyrazor Blog

How to Add User to Sudoers Ubuntu

February 6 2017 0
How to Add User to Sudoers Ubuntu

The sudo command is an important and commonly used command on Linux/Unix OS distributions Basically, it gives permission to a user to issue commands as another user on the Linux/Unix system. It’s also a way of granting root privileges to ordinary users on the server. In this tutorial, we’ll show you how to quickly create a user on Ubuntu server.
 

[SPECIAL OFFER]: Lightning Fast VPS Hosting

[BENEFITS]:

  • Expert VPS Hosting Provider
  • Root Access to Run Any Software Stack
  • Professional Linux Administrators on Hand
  • 24/7/365 Technical Support

Click here to access this [SPECIAL OFFER]

 

How to Add User to Sudoers Ubuntu

  • First, log into the server using your root user credentials.
  • Execute the following adduser command to create a new user on the server:


    # adduser username

     
    Note: “username” should be the user name of the user you’re creating.

  • You will then get prompted for the password of the new user, go ahead and enter the password and confirm it as well.
    How to Add User to Sudoers Ubuntu
  • The next set of prompts will ask you to provide the new user’s information. You can enter anything you want in response. It’s equally perfectly okay if you don’t provide a value for any specific information requested:
    How to Add User to Sudoers Ubuntu
  • Now that the new user has been created, let’s go ahead and add the user to the sudo group using the usermod command:


    # usermod -aG sudo username

     
    The above command adds the user to the sudo group which automatically grants that user sudo privileges as designed by Ubuntu.

  • So let’s now test the sudo access granted to the new user and make sure that it’s working.

    • Switch to the new user account by executing the following command:


      # su - sudotest

      How to Add User to Sudoers Ubuntu

    • Check to make sure that you can use the sudo command. To do this, add “sudo” (without the quotes) to any command you want to run with sudo privileges:


      username$ sudo "command_to_run"
    • For example, let’s list the contents located in the /root directory/folder:


      username$ sudo ls -la /root

      In every new session, whenever you use sudo for the first time, you’ll be asked for password authentication of that user and once you provide the password, you won’t be asked that again for the remainder of that session.

      When you run the above command, you’ll get the password prompt – go ahead and enter the password. Once entered and authenticated, you’ll see an output similar to the one below:
      How to Add User to Sudoers Ubuntu

  • Hope you found this tutorial on How to Add User to Sudoers Ubuntu useful!

 

[SPECIAL OFFER]: Lightning Fast VPS Hosting

[BENEFITS]:

  • Expert VPS Hosting Provider
  • Root Access to Run Any Software Stack
  • Professional Linux Administrators on Hand
  • 24/7/365 Technical Support

Click here to access this [SPECIAL OFFER]