Jump start in to CentOS – How to Create a new Sudo User

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 the easiest way to create a new user with sudo access on CentOS, without having to modify your server’s sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.

It is often advisable to completely disable root login through SSH after you have set up an SSH user account that has sudo privileges. Skip to the end to see how to do this.

Steps to Create a New Sudo User

1. Log in to your server as the root user.

ssh root@server_ip_address

2. Use the adduser command to add a new user to your system.

Be sure to replace username with the user that you want to create.

adduser username

Use the passwd command to update the new user’s password.

passwd username

Set and confirm the new user’s password at the prompt. A strong password is highly recommended!