DEV Community

Cover image for How To Create A New User And Assign Super User Privileges On Your Ubuntu Server
Samuel Opoku Asare
Samuel Opoku Asare

Posted on

How To Create A New User And Assign Super User Privileges On Your Ubuntu Server

Whether you are a seasoned developer or a DevOps engineer, setting up a dedicated Ubuntu server is a common task when working with Infrastructure as a Service (IaaS) providers. One of the first things you'll need to do is create a new user and grant them superuser privileges. This guide will walk you through the process seamlessly. Before we proceed, ensure that you have already connected to your remote server via SSH.

Creating a New User

To begin, you will need to create a new user. This process is straightforward:

  1. Open your terminal.
  2. Execute the following command:
   sudo adduser [user_name]
Enter fullscreen mode Exit fullscreen mode

Replace [user_name] with your desired username. During this process, the system will prompt you to enter a password and other details such as the full name, room number, and more. Ensure you choose a strong password to maintain server security.


Assigning Superuser Privileges

Once the new user is created, the next step is to grant them superuser privileges. This will allow the user to perform administrative tasks using the sudo command.

  1. Run the following command:
   sudo usermod -aG sudo [user_name]
Enter fullscreen mode Exit fullscreen mode

Again, replace [user_name] with the username you set up previously. This command adds the new user to the sudo group, enabling them to execute commands with elevated privileges.

And that's it—in just a few commands, you have successfully created a new user with superuser privileges on your Ubuntu server. This configuration will empower the user to perform critical tasks while maintaining a secure environment.

Feel free to share your thoughts and experiences. If you want to learn more about similar topics, don't hesitate to check out my other work.


More about the author here.
Cover photo by Tima Miroshnichenko.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay