Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

1.4 Reset the root user password


May 23, 2021 That's what Linux should learn



Weekdays give operations personnel a lot of headaches, so occasionally forget the Linux system password does not need to panic, just a few simple steps to complete the password reset work. H owever, if you are reading this book for the first time, or if you have no previous experience with Linux systems, be sure to skip this section and wait until you have finished learning the commands of your Linux system. I f you've just taken over a Linux system, first determine if it's a RHEL 7 system. If so, then do the following.

[root@linuxprobe ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo)

Step 1: When restarting the Linux system host and the boot interface appears, press the e key on the keyboard to enter the kernel editing interface, as shown in Figure 1-46.

1.4 Reset the root user password

Figure 1-46 The boot interface of the Linux system

Step 2: Append the "rd.break" parameter at the end of the line of linux16 parameters, and then press the Ctrl-X key combination to run the modified kernel program, as shown in Figure 1-47.

1.4 Reset the root user password

Figure 1-47 Editing interface for kernel information

Step 3: After about 30 seconds, enter the emergency call mode of the system, as shown in Figure 1-48.

1.4 Reset the root user password

Figure 1-48 Emergency mode for Linux systems

Step 4: Enter the following commands in turn, wait for the system restart operation is complete, and then you can use the new password linuxprobe to log on to the Linux system. The effect of the command line execution is shown in Figure 1-49.

mount -o remount,rw /sysroot chroot /sysroot passwd touch /.autorelabel exit reboot

1.4 Reset the root user password

Figure 1-49 Reset the root administrator password for linux systems