Reset forgotten root or user password in Red Hat Linux 8 | Prepare RHCSA on RHEL

۱۷


۰

In this video tutorial of Red Hat Certified System Administration (RHCSA), I will show you how to reset the forgotten root or any other user password. So, let’s get started. Here, I am in the RHEL 8 server. First of all, I try to log in as student user. I click on the user, give the password. The password is wrong and it says, ‘Sorry, that didn’t work. Please try again’. I try another password, still it’s wrong. I forgot the password. Click on Not listed. Give the username as root and enter the password that I remember. Root password too didn’t match. Again, I try another password. I am unable to login to the server by any means. In this case, instead of installing another server and configure all the running services and getting the data back, we can reset the password. First of all, let’s see how to reset the root password. First of all, reboot the server. When you get to select operating systems also called grub menu, press ‘e’ key in your keyboard to interrupt the boot process. This will lead you to the kernel boot parameters. Find the line starting with linux then go to the end of the line, remove ro crash and then append rd.break enforcing=0. When done press ctrl+x to start the system. This takes you to a shell. Here, type mount –o to override the current mount and type remount,rw /sysroot to remount root of the system with rw flag since it is in read only. I think I mistyped something. Oh yes ! It became zero instead of o. So I correct it and rerun the command set. Then type chroot /sysroot to switch to /sysroot directory and reset root password. Now reset root password using passwd root. Give new password. It’s saying bad password as I gave simple password, still it accepts this weak password. But you are recommended to create a strong password. Retype the password and hit enter. As we can see, the password is updated with new password. Now, type touch /.autorelabel to enable SELinux relabeling by empty file to /.autorelabel. Then type exit and again exit. The system resumes as normal reboot and checks SELinux policy against all system files and directories. Checking is done. Now the system starts normally. Here, we haven’t reset the login password of Student user. So, I click on Not Listed ? We reset the password of root, so I give the username as root and password as the last changed. We can log in to the system. Open the terminal, press ctrl+shift++ to zoom in the terminal. Then change the password of the user with the command passwd and the username i.e. student. Give a new password, retype the password to confirm. The password is changed. To verify, I reboot the server. Click on the Student, give the password that we just changed. Now, I can login to the student user. Okay guys, this is how we can reset the forgotten root password and a user’s password in Red Hat Enterprise Linux 8 server. That’s all for now, thanks for watching this video, see you in the next until then have a nice time good bye !

Published by: Network Heros
Published at: ۸ months ago
Category: