Debian is the oldest Linux distribution. Debian is one of the most popular Linux distributions. As of 2018, DistroWatch lists 141 active Debian derivatives using Debian codebase. The most popular ones are Ubuntu, Linux Mint Debian project, Knoppix, Deepin and so on.

 When we install a fresh copy of this operating system, the root password is not set by default. So, in this article, we will be discussing how to set the root password.

Note:

1. Directly logging in as root is like playing with fire. Because one little typo is enough to lose critical data or make your system unbootable.

2. Note that desktop environments will function differently if you log in to them as root.

3.This article holds good for Debian and Debian based Linux distributions

To set a root password, run the following command:

$ sudo passwd

Type in the password for your logged in user and press <Enter> to continue.







Now type in your desired root password and press <Enter>.



Retype the root password and press <Enter>.










The following message will appear:

passwd: password updated successfully








You have successfully set your password. Now you can log in as root using your root password.

If the above message showed up on your terminal, then you can now use the root privileges by typing:

su

And then type the password you have chosen. That's it!

Else, start over the steps of the answer, you probably typed something wrong.

If you wish to change the root password, all you need to do is to run the command again:

$ sudo passwd

Now do the same things as discussed in this article.

 If you have any questions about it please do not hesitate to comment below.