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 rootwhen you need root access
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.
Creating a user with restricted rights, and intervening in the system with root rights.
You can create a new user with the following command:
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.
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:
You must then enter the password associated with the root user to validate the operation.
Another option is to add a limited user account.
The process is simple for Ubuntu.
Add a user
Then, add the user to the
Linux 101: Introduction to sudo explains about sudo
adduser CustomUserName sudo
This user can use elevated privileges by prefixing every command with
sudo. The user will have to enter their password during the sessions.
It is recommended that you use a password-less login for all users. Instead, create SSH keys for the logins.