To reset the root password on Ubuntu 22.04, you can follow these steps:
- Reboot your system and wait for the GRUB menu to appear.
- Once the menu appears, select the “Advanced options for Ubuntu” entry and press Enter.
- Select the kernel you want to boot and press “e” to edit its boot parameters.
- Find the line that starts with “linux” and add the following text to the end of the line: “init=/bin/bash”. This should look like “linux /boot/vmlinuz-5.16.0-rc6 root=/dev/sda1 ro init=/bin/bash”.
- Press Ctrl+X or F10 to boot with the modified parameters.
- Your system should boot into a root shell with a command prompt. Enter the following command to remount the root filesystem in read-write mode:
mount -o remount,rw /
- Now, you can use the following command to change the root password:
passwd root
- Follow the prompts to set a new password.
- After changing the root password, you should run the following command to restart the system:
reboot -f
- Once the system restarts, you should be able to log in as root with your new password.
Note that resetting the root password in this way can be a security risk if someone gains physical access to your system. It is recommended to use other security measures, such as encryption and strong passwords, to protect your data.
It’s asking me for current root password.