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.

Top comments (0)