Title: Restoring Root Password
Entry Number: 2152
Creation Date:  June 17, 1996
Last Updated:  June 17, 1996
Keywords: Restore, Recover, Lost, Root, Password

Q: How do I restore a lost root password?
A: The root password is essential to system security and should always be safeguarded.
Unfortunately, anything can be lost, and a password is no exception.

To assign a new root password when you're unable to log in as root, follow these procedures:

1. Turn the computer off and then on, using the Power key.
2. During the boot process, immediately after the "Testing System" message is replaced by
the "Loading from disk" message, hold down the Command bar and press the ~ key (without
pressing Shift). On keyboards with two Command keys, hold down the right Command key and
press the ~ key. This displays the ROM monitor window.

Warning: If a hardware password has been set, you must supply this password before
you can boot the computer. If you don't supply the hardware password, you'll be unable to
complete the remainder of this procedure. (For more information on the hardware password,
see "The ROM Monitor" in Chapter 9.)

3. Do only one of the following: 3a for NeXT hardware OR 3b for Intel hardware.
3a. NeXT Hardware  Start up the machine in single-user mode by entering one of the
following commands at the ROM monitor prompt:

bsd -s (To boot from the hard disk)
bfd -s (To boot from the internal floppy disk)
bod -s (To boot from the optical disk)
ben -s (To boot from the Ethernet)

3b. Intel Hardware  Start up the machine in single-user mode by entering the following
command at the boot: prompt:

-s

The system starts up, displaying a series of messages. When startup is complete, you see the single user prompt #.

4. At the single user prompt, start up the system services by entering the following command:

sh /etc/rc &

You see a series of messages appear on the screen as the rc shell script executes. During this process, NetInfo is started. You won't see a shell prompt after these messages unless you press Return.

5. Set the root password. Enter:

passwd root

You're prompted twice for the new password.

6. Turn the system off and then on again. After the system boots, you can resume normal
operation with the new root password.

Warning: Don't try to continue the boot into multiuser mode. If you do, you'll start duplicate
system services, which will cause a number of problems. You must halt the system and reboot.