RackNerd Billboard Banner

How to create a new user with admin privileges on Linux

Need to add a new admin user on your Linux server or local machine? Whether you’re managing a VPS or setting up a new workstation, giving someone administrative access (aka sudo privileges) is a common task. Here’s how to do it quickly and safely, step by step.

Step 1: Log in as Root or a Sudo User

You’ll need root access to create a new user with admin rights. If you’re not already the root user, switch to one using:

sudo -i

Or if you’re already root, you’re good to go.

Step 2: Create the New User

Run the following command, replacing newusername with your desired username:

adduser newusername

You’ll be prompted to set a password and fill in optional user info. Only the password is required—feel free to leave the rest blank.

Step 3: Add the User to the sudo Group

On most modern Linux distributions (like Ubuntu and Debian), adding a user to the sudo group grants them admin privileges:

usermod -aG sudo newusername

If you’re using CentOS, RHEL, or Fedora, you may need to add the user to the wheel group instead:

usermod -aG wheel newusername

Step 4: Verify the Privileges

To test that everything’s working, switch to the new user:

su - newusername

Then try a command with sudo, such as:

sudo whoami

If it returns root, you’re done. Admin access is working.

Optional: Customize Sudo Access (Advanced)

If you want to fine-tune what this user can and can’t do with sudo, you can edit the sudoers file:

visudo

Then add a line like this (advanced use only):

newusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl

This would let them run systemctl without a password, but nothing else.


Summary

To give a new Linux user admin powers:

  1. Create the user with adduser.
  2. Add them to the sudo or wheel group.
  3. Test access with sudo whoami.

That’s it. Simple, fast, and secure.

Got questions or want more Linux tips? Drop them in the comments below.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
0
Would love your thoughts, please comment.x
()
x
Copy link