HomeНаука и техникаRelated VideosMore From: Business Server Solutions

Reset forgotten root password in Redhat 7

65 ratings | 13210 views
Red Hat Enterprise Linux 7: Reset forgotten root password. This video tutorial is part of RHCSA Fast Track course. Please use below cookbook to reset forgotten or unknown password in Red Hat Enterprise Linux, CentOS Linux, Scientific Linux, Oracle Linux and Fedora. 1) Reset Linux server if it is running 2) press e to edit default entry on grub bootloader menu 3) replace keyword "rhgb quiet" with init=/bin/bash 4) press CTRL + x to boot into root shell 5) remount / (root) filesystem with read write options 5.1) / (root) filesystem is mounted with ro (read-only options) mount | grep -w "/" 5.2) remount / (root) filesystem with rw (read write) options mount -o remount,rw / 5.3) doublecheck if / root filesystem has been remouted with rw (read-write) options mount | grep -w "/" 6) Change root password passwd 7) relabel SELinux context for entire root filesystem Below command will ensure that the SELinux context for entire filesystem will be relabeled after reboot: touch /.autorelabel 8) Continue boot process - run exec /sbin/init command exec /sbin/init Related Video Tutorials: RHCSA Fast Track course: Reset forgotten root password in Redhat 7: https://youtu.be/cUG16kdYCxE Network Interface naming convention in Red Hat 7: https://youtu.be/oPLEYK-we1A Setting up network without NetworkManager in Redhat 7: https://youtu.be/WwzO2rzaXtI Setting up network using NetworkManager and network scripts in Redhat 7: https://youtu.be/7PwA__i9Bi0 Setting up network using a NetworkManager text user interface (nmtui) in Red Hat 7 - EASY!!! https://youtu.be/IKH1sCEjG2A Setting up network in Red Hat 7 in less than a minute - QUICK & EASY!!! https://youtu.be/TqMdzTPsjJY Setting up network using a NetworkManager command line interface (nmcli) in Red Hat 7 https://youtu.be/v-soSvSsw18 nmcli cheat! Setting up network using nmcli in Red Hat 7 in less than a 30 seconds - QUICK & EASY!!! https://youtu.be/NqEuucdSS60 The Complete Beginners Guide to Linux Network Configuration - GUI & Easy! https://youtu.be/1LcAdQWF6KQ Shrink ext2 ext3 and ext4 file system and reduce the size of a logical volume with only one command. https://youtu.be/tTpStv6cfeQ Complete guide to file system shrinking and reducing the size of the underlying logical volume. https://youtu.be/8AD8ZiYDavY
Html code for embedding videos on your blog
Text Comments (11)
Prince Jaiswal (3 months ago)
You make it easy for us ... Thanks sir
Hello Prince. Thank you very much for watching my video tutorial. I am currently working on two new RHCE EX300 videos. I will upload first of them shortly. Thanks for watching.
Jeremy Canfield (1 year ago)
Definitely the best video on this topic.
Hello Jeremy, I am glad that you enjoyed my video. Thank you very much for watching. Thanks.
jawad boogschutter (2 years ago)
nice video's
Hello Jawad, I am very happy that you enjoyed my video. Thank you very much for watching and comment. Thanks.
Rick Gaine (2 years ago)
What if there is a password on the grub at menus, and you can't change them?
There will be not password protected GRUB on your RHCSA EX200 exam. If you need to reset root password on systems where GRUB is password protected, please follow procedure from my earlier comment. If you on the other hand want to have root password bullet proof, please use password protected GRUB and encrypted disk for example with LUKS. Once you will have encrypted root FS (files /etc/passwd, /etc/shadow ...) with LUKS it will be impossible to reset root password without knowing LUKS passphrase. Thank you very much for watching my video and leaving your comment. It is very appreciated.
Hello Rick, If your GRUB is password protected, you will have to boot from CDROM or USB drive to change root password. Please follow this procedure: 1) Start the system and when BIOS information is displayed, select the option for a boot menu and select to boot from the installation disk. 2) Choose Troubleshooting. 3) Choose Rescue a Red Hat Enterprise Linux System. 4) Choose Continue which is the default option. At this point you will be promoted for a passphrase if an encrypted file system is found. 5) Press OK to acknowledge the information displayed until the shell prompt appears. 6) Change the file system root as follows: sh-4.2# chroot /mnt/sysimage 7) Enter the passwd command and follow the instructions displayed on the command line to change the root password. 8) Remove the autorelable file to prevent a time consuming SELinux relabel of the disk: sh-4.2# rm -f /.autorelabel 9) Enter the exit command to exit the chroot environment. 10) Enter the exit command again to resume the initialization and finish the system boot. This procedure was taken from: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-Terminal_Menu_Editing_During_Boot.html#proc-Resetting_the_Root_Password_Using_an_Installation_Disk
shukurillo iminov (2 years ago)
Perfectly explained tnx
Hello Shukurillo, I am happy that you enjoy that video. Thank you very much for watching. Please check also https://youtu.be/NqEuucdSS60 I think you may find it interesting as well. Thanks.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.