Step 5: Create another User

Another method of logging in without the root password is to create a user with restricted rights.

  • The user could be a part of SUDO group

  • Or, you can su root when you need root access

Create Non-privileged User

You can do most of your work without logging in as root. At times you will still need to use root privileges.

This text is from OVH’s Securing a VPS guide.

  1. Creating a user with restricted rights, and intervening in the system with root rights.

    • You can create a new user with the following command:

    adduser CustomUserName
    
  2. Then fill in the information requested by the system (password, name, etc.). This user will be allowed to log in to your system via SSH, with the password specified when the account was created.

  3. Once you are logged in to your system with these credentials, if you want to perform operations that require root rights, simply type the following command:

    su root
    
  4. You must then enter the password associated with the root user to validate the operation.

Add a Limited User account

Another option is to add a limited user account.

The process is simple for Ubuntu.

  1. Add a user

    adduser CustomUserName
    
  2. Then, add the user to the sudo group.

    adduser CustomUserName sudo
    
  3. This user can use elevated privileges by prefixing every command with sudo. The user will have to enter their password during the sessions.

Note

It is recommended that you use a password-less login for all users. Instead, create SSH keys for the logins.