The root user (or superuser) is a special user account that exists on all Linux systems and and all systems built on Unix. It has full access to every command and any resource on the system without any restrictions.
If you are using Ubuntu which is one of the Linux distributions, you might be wondering what the default root password is or how to change the root password. By default, on Ubuntu, the root user account is disabled for security reasons.
This guide will explain in full how to temporarily change to the root user account and how to set a root password on the Ubuntu Linux operating system.
Temporarily switch to root
Ubuntu Linux users are encouraged to perform system administration tasks by granting privileges
sudo to ordinary users. Sudo allows authorized users to run programs as other users, usually users
The initial users created when installing Ubuntu were already members of the sudo group. Chances are that the user you are logged in with is already granted administrative rights.
To temporarily increase the privileges of the root user, run a command prefixed with sudo:
$ sudo command-name
The first time you use sudo in a session, it will ask you to enter the user password or the user password.
To temporarily switch to the root account in the current login session, you can use the command
sudo su or
sudo -i and enter the user password:
$ sudo su -
Run the whoami command to verify that the user was modified:
Changing the Root Password
The root user is disabled, but that doesn’t mean that the root account has been deleted. Logging in as root is not possible because no password has been set for the root account.
If for some reason, you need to activate a root account, all you need to do is set a password for the root user. In Ubuntu, you can set or change a user account password with commands
To change the root user password in Ubuntu, run the following command as a user
$ sudo passwd root
You will be asked to enter and confirm the new root password.
When setting a password, make sure you use a unique and strong password. Having a strong password is the most important aspect of your account security. Often strong password has at least 16 characters with a combination, at least one uppercase letter, one lowercase letter, one number, and one special character.
When you type a password, the password is not displayed on the screen.
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
And that’s it! now the root password has been changed.
Now you can log into your Ubuntu system as root using the new password.
By default, on Ubuntu, the root account does not have a password set. The recommended approach is to use commands
sudo to run commands with root-level privileges.
To be able to log in as root directly, you must set a root password.
And that’s the guide on how to change the root password on Linux Ubuntu, hopefully this simple article can help you learn Linux well. Good luck 🙂