How to Create a Sudo User on CentOS | Ubuntu



How to Create a Sudo User on CentOS | Ubuntu

How to Create a Sudo User on CentOS | Ubuntu

Sudo = Super user do!

In this tutorial, I will go over the steps needed in order to create a user with elevated privileges ( sudo) on CentOS, and Ubuntu.

Main commands used on both systems:

add user and set up password:

adduser UserName

passwd UserName

Command ” visudo ” to open sudoers configuration file:
visudo (File Path: vi /etc/sudoers )

wheel group ( in CentoOS). This group grant access to elevated privileges:

## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

remove # sign:
%wheel ALL=(ALL) ALL

Add user to wheel group:
usermod –aG wheel UserName

substitute user ( switch to another user):
su – UserName

list files with sudo privileges:
sudo ls -la /root

Add the username after root line in the sudoers file:

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
UserName ALL=(ALL) ALL

Ubuntu add user to sudo group:
sudo usermod -aG sudo newuser

Check the user groups:
groups newuser

Tutorial Parts:

Intro: 00:00
Centos Steps: 00:53
Ubuntu Steps: 10:00

Thank you for watching!

Like & subscribe!