157 lines
7.8 KiB
HTML
157 lines
7.8 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; Linux 2.0.36 i586) [Netscape]">
|
|
<TITLE> Breaking Into Your Own System LG #41</TITLE>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
|
|
<center>
|
|
<H1><font color="maroon">Breaking Into Your Own System</font></H1>
|
|
<H4>By <a href="mailto:mark@tcu-inc.com">Mark Nielsen</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
Hello!
|
|
<BR>If there are any changes to this article, it will be located at <A HREF="http://www.tcu-inc.com/mark/articles/Breaking.html">http://www.tcu-inc.com/mark/articles/Breaking.html.</A>
|
|
This brief article is just my easy way to break into my own system if I
|
|
screw up the root password. There are much easier ways to do it, but this
|
|
can also be used if you cannot log into your system if a configuration
|
|
file is messed up.
|
|
<P>Okay, this isn't a Linux independent OS solution. I use a bootable cdrom
|
|
that I got from www.cheapbytes.com which is a cheapbytes version of the
|
|
RedHat 5.2 cd.
|
|
<P>For this documentation, I am going to assume the computer is partitioned
|
|
in the following manner:
|
|
<BR> /dev/hda1
|
|
swap partition
|
|
<BR> /dev/hda2
|
|
root partition for Linux or "/"
|
|
<BR> /dev/hda3
|
|
DOS partition (yes, I know, it is scary to put nasty software on the same
|
|
hard drive as Linux)
|
|
<P>/dev/hda2 means we are using the master hard drive on the primary IDE
|
|
controller and root is on the 2nd primary partition on the hard drive.
|
|
If your root is on the first primary partition, it would be /dev/hda1.
|
|
<P>Here are the steps I use to hack into my own computer.
|
|
<P>1. Make your system bootable off of the cdrom in your computers BIOS.
|
|
If your computer doesn't support booting off of the cdrom, then you will
|
|
have to figure out how to do it with bootable floppy disks. For me, I just
|
|
want to use what is the fastest and easiest method, and so, I boot of off
|
|
cdroms. I haven't booted off of a floppy drive in ages.
|
|
<P>2. Put in your cdrom into your cdrom drive and turn on your computer.
|
|
<P>3. Pretend to go through the installation of RedHat 5.2, and after
|
|
it asks you to put in the cdrom and it gets to next screen, you can now
|
|
goto the second console window.
|
|
<P>4. Press Alt-F2, Alt-F3, Alt-F4, Alt-F5, and then Alt-F1. You should
|
|
see various screens with different messages. The one we are concerned about
|
|
is Alt-F2.
|
|
<P>5. Okay, press Alt-F2.
|
|
<P>6. Type "cd /tmp" and press enter. This takes us to a directory
|
|
where we can make files, directories, etc.
|
|
<P>7. Now we need to make a temporary directory and a temporary device
|
|
for the partition on the hard drive that we want to look at or edit. Type
|
|
in the following commands
|
|
<BR>
|
|
mkdir /tmp/my_dir
|
|
<BR>
|
|
mknod /tmp/my_dev b 3 2
|
|
<BR>
|
|
mount /tmp/my_dev /tmp/my_dir
|
|
<BR>
|
|
df
|
|
<P>8. "mkdir" makes a directory for us to mount the a partition to.
|
|
<BR> "mknod" makes a device for 2nd partition on the
|
|
master hard drive. This lets us "see" the partition.
|
|
<BR> In particular, "b
|
|
3 2" means the following. "b" is for block device. "3" is the master hard
|
|
drive on the
|
|
<BR> primary IDE controller
|
|
on your computer. "2" means the second partition.
|
|
<BR> "mount" takes the device we can "see" and puts it
|
|
on top of the directory "/tmp/my_dir"
|
|
<BR> "df" just lets you see what file systems are mounted
|
|
and where they are mounted to.
|
|
<P>Now, for our example, we could either edit the password file or perhaps
|
|
do something simple like turning off xwindows from starting up if you have
|
|
your computer set to use xdm. Let's do the xwindows example.
|
|
<P>10. Do the following steps:
|
|
<BR> cd /tmp/my_dir/etc
|
|
<BR> vi inittab
|
|
<P>11. Now you need to know how to use vi which is a fantastic editor,
|
|
but it is a pain to learn. Here are some simple commands in vi.
|
|
<BR> "x" deletes a character.
|
|
<BR> "i" makes it so you can insert letters or characters.
|
|
<BR> "Esc" turns off inserting characters.
|
|
<BR> "wq!" writes, quits, and ignores any problems
|
|
with read only files.
|
|
<BR> "h" moves one character to the left
|
|
<BR> "l" moves one character to the right
|
|
<BR> "k" moves up one line
|
|
<BR> "j" moves down one line
|
|
<P>12. Now, go down to the line which should have something that looks
|
|
like
|
|
<BR> id:5:initdefault:
|
|
<P> Delete the "5" by positioning the cursor at
|
|
the "5".
|
|
<BR> Press "x".
|
|
<BR> Press "i" to insert a number. Press "3".
|
|
<BR> Press the "Esc" key.
|
|
<BR> Type "wq!" and press enter.
|
|
<P>13. Now you are done editing a file! What is the problem now? If you
|
|
reboot you will most likely loose all of your changes. You must unmount
|
|
the directory and then reboot.
|
|
<P>14. Do this
|
|
<BR> cd /tmp
|
|
<BR> umount /tmp/my_dir
|
|
<BR> df
|
|
<P>15. Now Press Crtl-Alt-Del to reboot. Also, take your cdrom out of
|
|
the cdrom
|
|
drive. When your computer restarts, I would recommend having your BIOS
|
|
boot off of the hard drive instead of a CDROM.
|
|
<P>That is it! You can also use this method to change the password file
|
|
and do other stuff.
|
|
<P>Naturally, having a password in your computers BIOS would be ideal.
|
|
If you haven't physically secured your computer, then anybody can do this
|
|
to the computer. Even if you put a password in the BIOS, someone could
|
|
always take out the hard drive by taking apart the computer.
|
|
<P>-------------------------------------------------------
|
|
<BR>Mark Nielsen
|
|
"Where 98 has no meaning."
|
|
<BR>www.tcu-inc.com
|
|
sales@tcu-inc.com
|
|
<BR>The Computer Underground, Inc. 614-485-0506
|
|
<BR>computers, programming, networking, Perl, PHP, SQL, HTMl, Linux, Unix
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1999, Mark Nielsen <BR>
|
|
Published in Issue 41 of <i>Linux Gazette</i>, May 1999</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./lg_tips41.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./sevenich.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|