Please follow the below steps:
Open the terminal.
Type su - and press enter. This will attempt to log you in as a "superuser."
Enter the root password when prompted.
If you get an "authentication error" message, which means your root account is likely locked.
Type sudo command and press enter (e.g. sudo ifconfig). When prompted for the password, you need to enter your user password, not the root password.
sudo is one of the preferred methods for distributions like Ubuntu, You can add/remove Users from /etc/sudoers.
For more details check out this cloud computing training