How To Create a New Sudo User Linux

Introduction

The sudo command provides a mechanism for granting administrator privileges — ordinarily only available to the root user — to normal users. This guide will show you how to create a new user with sudo access on Ubuntu 18.04, without having to modify your server’s /etc/sudoers file. If you want to configure sudo for an existing user, skip to step 3.

1. Logging Into Your Server

SSH in to your server as the root user:

ssh root@your_server_ip_address

2. Adding a New User to the System

Use the adduser command to add a new user to your system:

adduser giscord

Be sure to replace giscord with the user name that you want to create. You will be prompted to create and verify a password for the user:

Output
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Next you’ll be asked to fill in some information about the new user. It is fine to accept the defaults and leave all of this information blank:

Output
Changing the user information for giscord
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]

3. Adding the User to the Sudo Group

Use the usermod command to add the user to the sudo group:

usermod -aG sudo giscord

Again, be sure to replace giscord with the username you just added. By default, on Ubuntu, all members of the sudo group have full sudo privileges.

Leave a Comment

Recent Comments
    Login
    Loading...
    Sign Up

    New membership are not allowed.

    Loading...