How To Reset The Root Password On Ubuntu 22.04 LTS If Forgotten (Linux)

ProgrammingKnowledge
ProgrammingKnowledge
118.3 هزار بار بازدید - 12 ماه پیش - If you have forgotten the
If you have forgotten the root password on Ubuntu 22.04 and need to reset it, you can follow these steps:

1. Start by rebooting your Ubuntu system. When the GRUB bootloader menu appears, select the default Ubuntu entry, but do not press Enter. Instead, press the 'e' key to edit the boot options.

2. In the boot options, locate the line that starts with `linux`. At the end of this line, append `init=/bin/bash` to specify that you want to start a bash shell as the init process.

3. Press `Ctrl + X` or `F10` to boot into the modified boot options. This will start a bash shell with root privileges.

4. Once the bash shell is loaded, you will be at a root prompt (`#`). Enter the following command to remount the root filesystem in read/write mode:
```
mount -o remount,rw /
```

5. Now, you can reset the root password by entering the following command:
```
passwd root
```
You will be prompted to enter a new password for the root user. Enter the password and confirm it.

6. After successfully resetting the root password, remount the root filesystem in read-only mode using the following command:
```
mount -o remount,ro /
```

7. Finally, reboot your system by entering the following command:
```
reboot
```

Upon reboot, you will be able to log in as the root user using the new password you set.

Please note that resetting the root password should be done with caution and only when necessary. Make sure to keep your root password secure and remember it to avoid any potential security risks.

#Ubuntu #RootPassword #PasswordReset #SystemAdministration #Linux
12 ماه پیش در تاریخ 1402/04/12 منتشر شده است.
118,372 بـار بازدید شده
... بیشتر