Superuser (root) rights in Linux are the same as administrator rights in Windows - i.e. a user who has the right to perform all operations in the system without exception. Sometimes users forget the root password and are faced with the question - how can they regain superuser rights?
Necessary
computer, Live-CD of your Linux distribution
Instructions
Step 1
If the root user session is saved on the computer on one of the virtual consoles, then it is very easy to recover the superuser password. To do this, in the console with a root session, enter the passwd command. The passwd utility will prompt you for a new password and repeat it. Don't forget your new password
Running as root is actually a gross violation of security, so this method might only be useful to reckless users.
Step 2
You can try to recover the password through the GRUB bootloader menu. The bootloader parameters must have access to edit the boot parameters of the selected line.
Some Linux distributions have a system recovery mode. In the bootloader menu, select the recovery mode and then the prompt to change the superuser password in the recovery window. If there is no recovery mode, then do the following:
When booting GRUB, highlight the line with the Linux version for which you need to reset the password. Press the E key to edit the boot parameters of the Linux version. Highlight the kernel line. Add "singl" (single user mode) to the end of the line. Press the B key for the next boot. If the system starts asking for the root password, then add init = / bin / bash to the end of the line and press the B key again. You will see a prompt for root or a recovery menu where you need to select the line with root.
Step 3
You can also recover the superuser password using the Live-CD:
Boot into Live-CD mode (without installing the operating system on your computer). Open a terminal. In order to find out the location of the system to which you are going to recover the password, type the command sudo fdisk -l. Next, mount the partition you need with the command sudo mount / dev / your_system_partition / media / mount_point. Now go to the mounted partition from root using the command sudo chroot / media / mountpoint. And enter the passwd command, just like in the first step.