Lost Root Password.Now What?

There are a number of different ways to do root password recovery on
a Linux
system. Different distributions make it easier than others. RedHat makes
it very easy.

You must be physically in front of the system. Reboot the computer
(usually ctrl-alt-delete will do it safely) and after POST, the system
will come to a boot loader screen. Newer versions of RedHat (including
the
AS versions) use grub as the boot loader, so you should see a graphical
menu in which to select what kernel you want to boot.

Select the kernel
to
boot and then hit 'e'. This will take you into a mini-editor where you
can
change the line that's used to boot the system. What we want to do is to
pass an additional argument to the kernel, telling it what runlevel we
want to boot into. This will override the default runlevel setting in
/etc/inittab.

So after hitting 'e', we cursor down to the line that starts with
'kernel'
and cursor all the way to the end of the line. Put a space after any
existing kernel arguments and type the number '1' (without the single
quotes). Hit enter here to accept the change and you're back at the grub
boot screen. Then hit 'b' to boot to this line. The system will boot
into
runlevel 1 (single user mode) and you will be dropped to a root prompt
without being prompted for the password. From here you can type 'passwd'
to change the root password. When you're done, type 'exit' and the
system
will boot to the default runlevel.

This works on all distributions; however some distros by default will
require that you know the root password before letting you boot into
runlevel 1 (Mandrake and SuSe come to mind). You can also
password-protect grub itself so you have to know a special password in
order to change the boot options.

On distros like this, the easiest way to change the root pw is to boot
off
of a linux bootable cd-rom. There are many freely available
'rescue'-type
distros out there, some even small enough to fit on a floppy. My
personal
favorite is Tom's Boot/Root disk (http://www.toms.net/rb/).
The steps to
do password recovery with a boot/root disk are:

- Boot to the boot/root disk
- Mount your existing root partition under a temp directory
- edit the /etc/shadow file on your root partition
- Remove the encrypted password from root's entry in the shadow file
(the
second field in this colon delimited file)
- Reboot and boot to your normal partition. Root's password is now
blank.

On a system with the root partition on /dev/sda1 (The first partition on
the first scsi disk drive) it would look like this:

Note:This Oracle
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
Oracle forum.

Verify
experience!Anyone
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
publish
their Oracle
qualifications.

Errata? Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
feedback. Just e-mail: