How to Create a New sudo User Print

  • 0

Who this is for:
Linux VPS customers who want safer day-to-day server access.

Overview:
Instead of using root for everything, it is safer to create a normal user with sudo privileges.

Steps on AlmaLinux / CentOS / Rocky / Ubuntu / Debian:

  1. Log in as root.

  2. Create a new user:

 
adduser yourusername
 

or on some systems:

 
useradd -m yourusername
passwd yourusername
 
  1. Set a password for the user.

  2. Add the user to the sudo or wheel group.

For Ubuntu/Debian:

 
usermod -aG sudo yourusername
 

For AlmaLinux/CentOS/Rocky:

 
usermod -aG wheel yourusername
 

How to verify it worked:
Log in as the new user and run:

 
sudo whoami
 

It should return root.

When to contact support:
Contact support if sudo does not work or you accidentally remove your own access.


Was this answer helpful?

« Back