Ubuntu has no password after it is installed. You can set the password as follows: sudo passwd root. after the password is set, there will be a problem. For example, if you usually use sudo operations, you will forget the root password after a long time. What should I do now? I have encountered this problem before, and I have not found a proper solution on the Internet. Then I suddenly came up with a solution to this problem.
In Linux, the user's password file is stored in the/etc/shadow file. Each user records a line and the password is encrypted, but sudo can still edit the text. So I want to replace the character string encrypted by the current user's password with the root password string. Then I can use the password of the current system to log on to the root user. After testing, this method is unavailable for desktop Versions later than 9.0.4.
So I went to the carefree forum to ask this friend to know that the root account is not enabled by default after the Ubuntu Desktop version is installed. I only need two commands to reset the root password:
Enter Sudo-I and press Enter.
Enter sudo passwd root and press Enter.
Enter the password twice to reset the root password...