Creating a non-root user in Ubuntu 20.04 Print

  • 0

When you first set up an Ubuntu 20.04 server, it's important to set up a non-root user for security purposes.

Prerequisites


You'll need to be logged in as root to do this.

Creating a non-root user


Once you're logged in as root, you can create a new user by running the following: (With the username you'd prefer over scotty)

adduser scotty


You'll be asked some questions, including what you want the password to be. Enter a strong password, but none of the other inputs are required. You can just hit ENTER to skip any field you would like.

Granting the user permissions


The user we just created only has regular permissions, so we need to grant them full permissions if we want to use this user in the future instead of root.

To add these permissions we need to run the following command:

usermod -aG sudo scotty


That should be it! You should not be able to login into your new user's account through SSH with the username and password you inputted.


Was this answer helpful?

« Back