Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

Reset root password using rescue mode

Dezembro 31st, 2018

1. Check the partitions and find your drive using lsblk or fdisk -l

sysresccd ~ # lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   111.8G  0 disk
├─sda1   8:2    0       2G  0 part
├─sda2   8:3    0   109.6G  0 part
└─sda3   8:1    0     256M  0 part
sdb      8:16   0   931.5G  0 disk
sdc      8:32   0   931.5G  0 disk

If you using LVM

sysresccd ~ # lvscan

ACTIVE '/dev/VolGroup00/LogVol00' [230.75 GiB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GiB] inherit

2. Mount the Partition temporarily

sysresccd ~ # mount /dev/sda2 /mnt
sysresccd ~ # SHELL=/bin/sh
sysresccd ~ # chroot /mnt

3. Once the Partition is mounted, let’s reset password.

sysresccd ~ # passwd root
New password:
Retype new password:

4. Another example, your OS failed and you need backups. After the partition is mounted:

sysresccd ~ # cd /home (the folder that you have the files)
sysresccd ~ # zip -r backups.zip FolderWithYourFiles

Now you can login via FTP using the rescue credentials, go to the folder ( In this case /home ) and download the file you just zipped (backups.zip)