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.

About the author

Danyal Ali Butt

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts