I lost my Root user password:

Step 1:  Boot into single-user mode by appending the command line during but with the following

Single

Step 2: when you are presented with a command prompt, change the root user password.

#passwd root

Step3: Reboot the system and validate that the new root password works correctly:

#reboot

Password change not available in single-user mode:

When you enter single-user mode, you may encounter an issue where the root user’s password can’t be changed.

Step1: Verify the existence of the /etc/shadow file:

#ls /etc/ grep shadow

Step 2: If the /etc/shadow file doesn’t exist, use the pwconv cmd to re-create the /etc/shadow file:

#pwconv

Step 3: Now execute the passwd command to reset or change the root user’s password:

#passwd root

Step 4: Reboot the system and validate that the new root password works correctly:

#reboot  

The MBR is corrupt:

If you are having trouble booting the system and you have determined that the master boot record (MBR) is corrupt you need to boot into rescue mode. Use the Red Hat DVD, boot from it, and choose the option to enter rescue mode.

Step 1: After you boot, enter the GRUB shell:

# grub

Step 2: Locate the root drive:

Grub>root

Step 3: Reinstall the MBR from the GRUB shell:

Grub> setup (hdʘ)

Step 4: Reboot the system to validate that the system boots properly:

#reboot  

Repair the file system:

When we have an inconsistency to the file /etc/fstab and the file systems listed by blkid utility. Then the system will go to rescue mode

---> To troubleshoot this problem provide the root password for the maintenance

---> When we provide the root password correctly then a shell prompt will be opened

---> At this movement the file system is mounted in read-only mode, hence we can’t change the file system table (fstab file)

---> So mount the file system in rw mode

#mount –o remount, rw/

---> Now open the file /etc/fstab

#vim/etc/fstab

Now remove (or) change the file systems which leads to inconsistency and save the fstab file and reboot the pc

#init 6

(or)

#reboot

Inclined to build a profession as Linux Developer? Then here is the blog post on, explore Linux Training

Assign the grub password:

The grub password is to be maintained in the file

“/boot/grub/grub.cong”.

#grub-md5-crypt              >> /boot / grub /grub.conf

When we type the above command then an encrypted password comes to the last line of the file 

/boot/grub/grub.conf

We have to copy that encrypted password and paste in the same file under the line “hidden menu”

Password – md5               <encrypted passwd>

Here we have to paste the encrypted password  

Recover root & grub password:

Step 1: use the Red Hat DVD, boot from it, and choose the option to enter Rescue mode

Boot: Linux rescues

Select keyboard => select language => select networking

Then a shell will be opened

At this moment to give the privilege to the root user to maintain the file system

#chroot /mnt/sysimage

Here we can follow the above-mentioned procedures of recovering the root password and grub password.

The superblock  Has Become corrupt:

If the superblock on your system has become corrupt, you can re-create it with one of the backup superblocks. If the primary file system has the corruption you may need to use single-user mode or the rescue environment to perform the recovery.

Step 1: Check the state of the file system:

#dumpe2fs          h             /dev/sda 1

Step 2: Find a valid backup superblock:

#dumpe2fs          /dev/sda 1 / grep –i superblock

Step 3: Repair the file system with a backup superblock:

#e2fsck                -f            -b           8193 /dev/sda1

For an in-depth understanding of Linux click on