(Ubuntu:
Lesson 5)
{ Using a Live CD to
clear root's password in /etc/shadow }
Section 0.
Background Information |
- Background information.
- The following lab will show you how to
use a Live CD/iso to clear root's password from the /etc/shadow file.
- Also, this lab will show you how to remove
the PAM security to prevent a user from logging in with a blank
password.
- This lab is assuming
a power on password is not set.
- Prerequisite
-
Lab Notes
- In this lab we will how to do the following:
- We will show you how to use a live
CD/iso to remove a password from the Grub.
- We will show you how to disable PAM's
security to prevent a user from logging in with a blank password.
- We will show you how to change the root
password.
- Legal Disclaimer
- As a condition of your use of this Web
site, you warrant to computersecuritystudent.com that you will not use
this Web site for any purpose that is unlawful or
that is prohibited by these terms, conditions, and notices.
- In accordance with UCC § 2-316, this
product is provided with "no warranties, either express or implied." The
information contained is provided "as-is", with "no guarantee of
merchantability."
- In addition, this is a teaching website
that does not condone malicious behavior of
any kind.
- You are on notice, that continuing
and/or using this lab outside your "own" test environment
is considered malicious and is against the law.
- © 2012 No content replication of any
kind is allowed without express written permission.
Section 1: Start
Ubuntu 12.04 |
- Start Ubuntu 12.04
- Instructions
- For Windows 7
- Start --> All Programs --> VMware
Player
- For Windows XP
- Starts --> Programs --> VMware
Player
- Verify Virtual Machine Settings.
- Instructions
- Click on Ubuntu 12.04
- Click on Edit virtual machine settings
- Set CD/DVD(IDE)
- Instructions
- Click on CD/DVD(IDE)
- Select radio button: Use ISO image
file:
- Click the Browse Button.
- Navigate and Select the
ubuntu-12.04-desktop.iso file
- Not this can be any live linux iso.
- Click on the OK button.
- Start the Ubuntu 12.04 VM
- Instructions
- Click on Ubuntu 12.04
- Click on Play virtual machine
Section 2: Boot From
CD-ROM |
- Access the Boot Menu
- Instructions
- Once you see the below vmware screen,
(1) Left Click in the screen and (2) press the <Esc> key.
- Boot from CD-ROM Drive
- Instructions
- Arrow Down to where CD-ROM Drive is
highlighted
- Press <Enter>
- Ubuntu CD
- Instructions
- Click on the Try Ubuntu button
Section 3: Mount
Hard Drive |
- Ubuntu Dash
- Instructions
- Click on the Ubuntu Dash
- Terminal Windows Search
- Instructions
- Type "terminal" in the search box.
- Click on the terminal.
- Become Root
- Instructions
- sudo su -
- Identify Hard drive name and root partition
- Instructions
- fdisk -l
- Note(FYI):
- /dev/sda is the name of the hard drive
- /dev/sda1 is the boot partition which
is notated with a "*" in the boot column.
- Mount the root partition
- Instructions
- mount /dev/sda1 /mnt
- Navigate to Hard Drive
- Instructions
- cd /mnt
- ls
- Note(FYI):
- Changing directory (cd'ing) to /mnt
would be the same as changing directory (cd'ing) to / if we did not
boot from the CD-ROM.
Section 3: Editing
the Grub Configuration Files |
- Navigate to the etc/ configuration directory
- Instructions
- cd etc/
- Backup the shadow file
- Instructions
- cp shadow shadow.BKP
- ls -l shadow*
- Note(FYI):
- It's always a good idea to backup sensitive
configuration files before editing them.
- Open the shadow file
- Instructions
- vi shadow
- Edit the shadow file
- Instructions
- Make sure the cursor is on the first
line that starts with root.
- Cursor over to the right until the
cursor is immediately to the right of the first colon.
- dt:
- This will delete the encrypted
password between the first two colons.
- Continue to next step.
- Save the shadow file
- Note(FYI):
- Notice that root's encrypted file has
been cleared out between the first two colons.
- Instructions
- Press the <Esc> key.
- Type ":wq!"
Section 5: Remove
PAM security to prevent blank passwords |
- Navigate to pam directory
- Instructions
- cd /mnt/etc/pam.d/
- Make a backup of the common-auth file
- Instructions
- cp common-auth common-auth.BKP
- ls -l common-auth*
- Allow any user to login with a blank password
- Instructions
- grep nullok_secure common-auth
- No users are allowed
to login with a blank password, when
nullok_secure is set for the auth directive.
- sed -i 's/nullok_secure/nullok/'
common-auth
- Replace nullok_secure with nullok.
- Users are allowed to login
with a blank password, when nullok
is set for the auth directive.
- grep nullok_secure common-auth
- Notice that nullok_secure is no
longer in the common-auth file.
- grep nullok common-auth
- Although nullok_secure is not found
in the common-auth file, however, nullok is found.
Section 6: Reboot
and Test Blank Root Password |
- Reboot Machine
- Instructions
- cd /
- umount /mnt
- reboot
- Installation Media Message
- Instructions
- Press the <Enter> key
- Login to Server
- Instructions
- User: Student
- Password: Please supply the student
password.
- Start up a Terminal
- Instructions
- Click on the Terminal
- Test root's blank password
- Instructions
- su - root
- Note(FYI):
- Notice you were not prompted for a
password.
Section 7: Set Root
Password |
- Set root's password
- Instructions
- passwd root
- Enter new UNIX password:
- Retype new Unix password:
- grep root /etc/shadow
- Notice the encrypted password
between the first two colon delimiters.
Section 8: Disallow
BLANK password usage |
- Disallow blank password usage
- Instructions
- cd /etc/pam.d
- grep nullok common-auth
- sed -i 's/nullok/nullok_secure/'
common-auth
- grep nullok common-auth
- Proof of Lab
- Instructions
- ls -l /etc/shadow*
- ls -l /etc/pam.d/common-auth*
- grep "Successful su for root
by student" /var/log/auth.log | tail -1
- date
- echo "Your Name"
- Replace the string "Your Name" with
your actual name.
- e.g., echo "John Gray"
-
Proof of Lab Instructions
- Press both the <Ctrl> and <Alt> keys at
the same time.
- Do a <PrtScn>
- Paste into a word document
- Upload to Moodle
|
|