Linux / Unix

Create non root user in Ubuntu Server

In order to create a new user, you need root access to the server. Once you are logged in as a root, you are ready to add the new user account. It is discouraged to use root account on regular bases that has ability to make very serious changes. The solution is to create alternative account with reduced scope of influence for daily tasks

Creating a New User

Following example creates new user peter:

# adduser peter

You will be asked few questions, starting with account user password. Enter a strong password, and fill remaining information.

Grant Administrative Privileges

New created account has regular user privileges, in order to perform admin task user peter requires administrative rights, let grant admin rights to the user.

As a root run following command:

# usermod -aG sudo peter

That’s it, now when you login as peter, use sudo for administrative tasks.

Author: Danyal
I'm skilled programmer with expertise in Vue.js/Nux.js for front-end development and PHP Laravel for back-end development. I excel in building APIs and services, and also have experience in web server setup & maintenance. My versatile skill set allows you to develop and maintain web applications effectively, from the user interface to the server-side functionality. I love coding with never ending learning attitude, thanks for visiting