Redhat9 forgets the root password operation (applicable to ordinary users too)

Table of contents

1. Edit the startup entry

2. Press enter

3. Remount /sysroot, and modify the permission of /sysroot to rw

4. Change the root directory to /sysroot

 5. Modify password

5.1 Modify root password

 5.2 Modify the password of ordinary users

6. Create a file

7. Exit

8. Test


1. Edit the startup entry

When entering the following page, press the down arrow key of the arrow key to move, move to the second entry, and then press the e key to edit

 NOTE: Do not select the first entry for editing. If it is redhat8, the first entry is selected. The main difference between redhat8 and redhat9 forgot the root password is this place. The rest of the operations are pretty much the same.

2. Press enter

Press enter according to the prompt 

3. Remount /sysroot, and modify the permission of /sysroot to rw

mount -o remount,rw /sysroot (note the space)

4. Change the root directory to /sysroot

chroot /sysroot 

 5. Modify password

5.1 Modify root password

Use the passwd command to change the password of the root user. It needs to be entered twice. When it prompts successfully, the modification is successful.

passwd

 5.2 Modify the password of ordinary users

When changing the password of an ordinary user, you need to use the passwd command to keep up with the existing users. Then enter the password twice until prompted successfully.

passwd redhat (redhat is an existing user)

 Note: The password will not be echoed, so you need to remember the password.

6. Create a file

7. Exit

Press exit twice. Then wait quietly for a while and enter the login page.

8. Test

 

Guess you like

Origin blog.csdn.net/weixin_53308294/article/details/129898451