Situation may arise that you want to login as root
user and you don’t know or you forgot the
root password. In this case we need to boot in recovery mode. In some cases
recovery mode option will not prompt automatically so need to press left shift
key while booting. This will prompt option to boot in recovery mode. Once you
boot in recovery mode, various options will be available.
Selecting root option will login you as root in terminal without any password. Now you can create new root user, you can change the password of existing root user.
After you have successfully changed the password, you need to reboot the system and now you can login with your new password.
For this just refer following commands.
You can get the list of current user cat
/etc/passwd
You can add new user to the system
useradd username
You can set the password of the user passwd username