Packetwatch.net

Forgotten root password in MythDora



Last modified: Jan. 30, 2010

Contents
1 - Summary
2 - Console set to secure
3 - Console set to insecure


1 - Summary

This guide will show how to reset the root password in case you forgot it.
This has been tested in MythDora 10.21.


2 - Console set to secure

This method works where the console is set to secure in the
/etc/event.d/rcS-sulogin file with the following line: exec /bin/bash. MythDora
by default has the boot loader set to a timeout of 0 meaning it's never
displayed. We will change this to five seconds.
  timeout=5
# sudo vi /etc/grub.conf
[sudo] password for user:

When booting into single-user mode it doesn't prompt for the root password. If
you use default boot loader GRUB, press any key to enter the GRUB menu. Using
the arrow keys select the version of the kernel that you want to edit and press
[e] to enter into edit mode. Select the kernel line and press [e] to enter into
edit mode. Go to the end of the line and press space and then add the word
single to tell GRUB to boot into single-user mode. Press [b] to boot.
grub append> ro root=LABEL=/ rhgb quiet single

Reset the password for the root user.
[root@server /]# passwd root
Changing password for user root.
New UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully.

Reboot the system and log in with the root account using the new password.
[root@server /]# shutdown -r now


3 - Console set to insecure

This method works where the console is set to insecure in the
/etc/event.d/rcS-sulogin file with the following line: exec /sbin/sulogin. When
booting into single-user mode it does prompt for the root password. Boot from
the installation CD. In MythDora you will need to select "Rescue installed
system" which uses the following: linux rescue selinux=0.

Select a language at the Language menu and hit [Enter]. Select a keyboard at
the Keyboard Type menu and hit [Enter]. Select No at the Setup Networking
screen. Select Continue at the Rescue menu and hit [Enter]. The rescue
environment will try to find the Linux installation and mount it under the
directory /mnt/sysimage. The next screen lets you know if it was successful or
failed. Hit [Enter] to continue.

Get a list of the disks.
sh-3.2# parted -l | grep Disk | grep -v mapper
Disk /dev/sda: 2000GB
Disk /dev/sdb: 3000GB

Get information about the hard disks.
sh-3.2# dmesg | grep -e "\[sda]" -e "\[sdb]" | uniq
sd 6:0:0:0: [sda] 3906207744 512-byte hardware sectors (1999978 MB)
sd 6:0:0:0: [sda] Write Protect is off
sd 6:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 6:0:0:0: [sda] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
sd 6:0:0:0: [sda] Attached SCSI disk
sd 6:0:1:0: [sdb] Very big device. Trying to use READ CAPACITY(16).
sd 6:0:1:0: [sdb] 5859311616 512-byte hardware sectors (2999968 MB)
sd 6:0:1:0: [sdb] Write Protect is off
sd 6:0:1:0: [sdb] Mode Sense: 23 00 00 00
sd 6:0:1:0: [sdb] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
sd 6:0:1:0: [sdb] Attached SCSI disk

View information about the file systems.
sh-3.2# cat /mnt/sysimage/etc/fstab
# See man pages fstab(5), findfs(8), mount(8) and/or vol_id(8) for more info
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
/dev/VolGroup00/LogVol05 /home                   ext3    defaults,nodev  1 2
/dev/VolGroup00/LogVol04 /usr                    ext3    defaults,nodev  1 2
/dev/VolGroup00/LogVol03 /var                    ext3    defaults,nodev  1 2
/dev/VolGroup00/LogVol06 /recordings             ext3    defaults,nodev  1 2
/dev/VolGroup00/LogVol02 /tmp                    ext3    defaults,nodev  1 2
/dev/VolGroup01/LogVol00 /archives               ext3    defaults,nodev  1 2
UUID=0ea52841-4376-4340-9f08-c0e7b0c9cd21 /boot  ext3    defaults,nodev  1 2
tmpfs                   /dev/shm                 tmpfs   defaults        0 0
devpts                  /dev/pts                 devpts  gid=5,mode=620  0 0
sysfs                   /sys                     sysfs   defaults        0 0
proc                    /proc                    proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/cdrom              /media/cdrom             auto    noauto,ro,user,nodev,no
suid  0 0

Change the root directory to point to /mnt/sysimage and run the passwd command
for the root user.
sh-3.2# chroot /mnt/sysimage /usr/bin/passwd root
Changing password for user root.
New UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully.

Reboot the system and login with the root account using the new password. Make
sure to remove the installation CD.
sh-3.2# exit


Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2014.