How to reset the remote password of a Linux cloud server

06-30-2023


The knowledge points of this article on how to reset the remote password of a Linux cloud server are not well understood by most people, so the editor summarizes the following content for you, with detailed content, clear steps, and Certain reference value, I hope you can gain something after reading this article, let’s take a look at this article on how to reset the remote password of a Linux cloud server.


CentOS 8

Return to directory

1. When the GRUB version selection interface appears, press the Esc key immediately. Otherwise, the system will continue to start and cannot proceed to the next step.

1.jpg

2. Select the first kernel and press e to enter the editing interface.

2.jpg

3. Find the line whose first word is linux, and change ro in this line to rw init=/sysroot/bin/sh. Then press Ctrl+X to start the system in single-user mode.

3.jpg

4. After the system starts, enter chroot /sysroot to enter the system.

5. Use the passwd command to reset the password.


6. Relabel the file system, then exit and restart the system.

touch /.autorelabel exit log out reboot


7. After the system starts normally, you can successfully log in with the new password.

CentOS 7

Return to directory

1. The first 5 steps are exactly the same as the steps for resetting the password in CentOS 8. Only the content of the kernel file is different.


2. After resetting the password, enter reboot -f to force restart the system.


3. After the system starts normally, you can successfully log in with the new password.

CentOS 6

Back to Contents

1. When the Booting CentOS... prompt appears, immediately press any key to enter the kernel selection interface. Otherwise, the system will continue to start and cannot proceed to the next step.

2. Select the first kernel, press a key to modify the kernel parameters.


3. Enter the single character at the end of the line and press Enter.


4. After the system starts, use the passwd command to reset the password and restart.


5. After the system starts normally, you can successfully log in with the new password.

Ubuntu 19.04/Ubuntu 18.04

Return to directory

1. During system startup, press the Esc key immediately to enter the kernel selectioninterface. Otherwise, the system will continue to start and cannot proceed to the next step.

2. Select the first kernel and press e to enter the editing interface.


3. Find the line whose first word is linux, and add init=/sysroot/bin/sh at the end. Then press Ctrl+X to start the system in single-user mode.


4. After the system starts, enter mount -o remount,rw / to remount the system.

5. Use the passwd command to reset the password and force a restart.


6. After the system starts normally, you can successfully log in with the new password.

Debian 10/Debian 9

Return to directory

1. During system startup, press the Esc key immediately to enter the kernel selection interface. Otherwise, the system will continue to start and cannot proceed to the next step.

2. Select the first kernel and press e to enter the editing interface.


3. Find the line whose first word is linux, and add init=/sysroot/bin/sh at the end. Then press Ctrl+X to start the system in single-user mode.


4. After the system starts, enter mount -o remount,rw / to remount the system.

5. Use the passwd command to reset the password and force a restart.


6. After the system starts normally, you can successfully log in with the new password.

Fedora 31/Fedora 30/Fedora 29

Return to directory

1. When the GRUB version selection interface appears, press the Esc key immediately. Otherwise, the system will continue to start and cannot proceed to the next step.


2. Select the first kernel and press e to enter the editing interface.


3. Find the line whose first word is linux, and change ro in this line to rw init=/sysroot/bin/sh. Then press Ctrl+X to start the system in single-user mode.


4. After the system starts, enter chroot /sysroot to enter the system.

5. Use the passwd command to reset the password.


6. Relabel the file system, then exit and restart the system.

touch /.autorelabel exit log out reboot


7. After the system starts normally, you can successfully log in with the new password.

FreeBSD 12/FreeBSD 11/FreeBSD 10

Return to directory

1. When the system startup interface appears, press 2 to enter single-user mode.


2. Use the passwd command to reset the password and restart.


3. After the system starts normally, you can successfully log in with the new password.


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us