Creating a non-root user with sudo privileges in Ubuntu or any Linux-based OS is straightforward. Here’s how to do it:

Create a New User

sudo adduser newusername

Replace newusername with your preferred username.

Add the User to the Sudo Group

sudo adduser newusername sudo

Verify Changes

Run the following command:

id newusername

Look for 27(sudo) to confirm the user has sudo privileges.

That’s it!