This labs shows you a quick and easy way reset
the root password on a VMware BackTrack5R1 instance using a live CD.
It's embarrassing enough to forget, lose, or
simple not know the root password to your machine. It's even more
embarrassing to forget, lose, or mistake the root password to your
penetration testing machine.
Is you don't have a BackTrack ISO, then
click on the following link:
Password:
Type in
the wrong password on purpose!!!
Section 2. Edit
Virtual Machine Settings
Make sure your CD/DVD Drive is connected.
Instructions:
Virtual Machine --> Removable Devices
--> Connect
Make sure your CD/DVD Drive is connected.
Instructions:
Virtual Machine --> Virtual Machine
Settings...
Set Machine to Boot From CD/DVD
Instructions:
Select CD/DVD (IDE)
Select the "Use ISO image file" radio
button.
Browse to the location of your
BT5R1-GNOME.iso or other Live CD.
Select OK.
Reset BackTrack
Instructions:
Virtual Machine --> Power --> Reset
Booting from the ISO (Step 1)
Instructions:
At the same time, Click the right mouse
key and the press the ESC button, when the screen starts to change
to the VMware screen below.
Note:
This might take you a few times so be
patient!!!
Booting from the ISO (Step 2)
Instructions:
Arrow Down to "CD-ROM Drive"
Press Enter
Boot
Instructions:
Press Enter
Boot BackTrack Live CD
Instructions:
Select "BackTrack Text - Default Boot
Text Mode"
Press Enter
BackTrack5 Command Line
Note:
This is the screen you will see to
begin the reset process.
Section 3. Mounting
the Boot Disk
Discover the Boot Disk
Instruction:
fdisk -l
Note:
This server was built with all the
directories under the same partition.
Typically, productions servers will
have a partition per file system. In our case, this server was
built with all the directory and filesystems under one partition.
In the next step, we will mount up the
/dev/sda1 partition.
Mount the Boot Partition
Instruction:
mount /dev/sda1 /mnt
df -k
Note:
Since, all filesystems and directories
are located under /dev/sda1 we will be able to access any file.
Navigate to the etc directory
Instruction:
cd /mnt/etc
ls -l | grep shadow
md5sum /mnt/etc/shadow > /mnt/var/tmp/before.txt
This is part of the proof of lab.
Note:
By mounting /dev/sda1 to the /mnt
directory, we know have access to the shadow file.
Edit the shadow file
Instruction:
vi shadow
Edit the shadow file
Instruction:
Right arrow over to the immediate next
right position of the first colon.
Press the "x" to delete all the
characters, until you get to the second colon.
Note, do not delete the
colons.
Saving the shadow file
Instruction:
Press the "Esc" key
Press <Shift> and the ":" key.
Type wq!
Press enter
Note:
Congratulations, You effectively
cleared out the root password.
Post Lab Verification
Instruction:
md5sum /mnt/etc/shadow > /mnt/var/tmp/after.txt
ls -l /mnt/var/tmp/*.txt
cat /mnt/var/tmp/*.txt
Note:
The above command are not required to
reset/clear the root password.
This is only part of our pre-proof of
lab instructions.
Section 4. Reboot
BackTrack
Reboot the server
Instruction:
shutdown -r now
Press <Enter> when you see the line
that says "Please remove the disc and close ..."
Login as root
Instruction:
Type "root" at the bt login: prompt.
Note:
After you press enter, you will
not be
prompted for the root password.
Change Root Password
Instruction:
passwd root
Set the root password to our
standard classroom password.
Proof of Lab
Instruction:
ls -l /var/tmp/*.txt
md5sum /etc/passwd
md5sum /var/tmp/*.txt
date
echo "Your Name"
Replace "Your Name" with your
actual name.
e.g., echo "John Gray"
Change Back the Virtual Machine Settings
Instruction:
Virtual Machine --> Virtual Machine
Settings...
Change CD/DVD Settings
Instruction:
Select CD/DVD (IDE)
Select radio button "Use physical
drive:" and make sure "Auto detect" is selected.
Section 5. Proof of
Lab
Complete Section 4, Step 4, then upload to
Moodle.