For Linux, see /Linux/lostlinuxpassword.html
See this for Unixware 2.12.
If you have lost your root password on SCO Unix, the following procedures will help you. These MAY help you if you lost the root password on some other OS, but only conceptually: the specific procedure to recover (change, really) the root password will be different.
A couple of things first: sometimes you can login as root at the console on tty01 (Cntrl-ALT-F1) when you cannot anywhere else. That comes from an OVERRIDE=tty01 entry in /etc/default/login.
Also, it's worth checking ALL the multiscreens (Cntrl-ALT-F2, Cntrl-Alt-F# etc.) to see if there's a root login already from which you could just change the password.
People do manage to lose their root password. Maybe you inherited the machine, so you never knew it. Maybe you or somebody else accidentally changed it and don't know what you typed. Well, a lost root password is annoying, but hopefully it isn't the end of the world.
This procedure will work for Xenix, and for Unix as well if you are using a very relaxed security level (one which stores encrypted passwords directly in /etc/passwd). If you're using a higher security level on Unix, look for part 2 below.
Boot the system from your emergency boot diskettes (if you didn't make these and keep them up to date, shame on you, but you should be able to use N1/N2 instead, and see the entry on crashing out of these diskettes below).
Lost your N1 disk too? Well, on some versions you'll find an image and a Windows tool to make it on your CD. See Floppy Basics too.
If not, see if How can I download a boot disk? helps.
mount /dev/hd0root /mnt
; this will mount your hard drive's root filesystem on /mnt.
On some v5.0.x systems, /dev/hd0root won't exist. Create it with
mknod /dev/hd0root b 1 42
On SCO 3.2v4.2, use /dev/boot instead.
Note that if you are using a 5.0.x boot to get at an old 3.2v4.2 disk, hd0root isn't the right device. See SCO 3.2v4.2 root password.
Edit /mnt/etc/passwd. The first line will be your root line, such asroot:encryptedpasswordgoeshere:0:0:God,Everywhere:/:/bin/sh
Edit out the encrypted password (don't touch anything else!) so that the line reads something likeroot::0:0:God,Everywhere:/:/bin/sh
Save the file and shut down. Reboot from the hard drive. Your root password has now been removed, and you can reset it normally.
Also see /Boot/defs.html#bootfloppy.[Table of Contents]
In more recent versions of SCO, you boot directly from the CD, not a floppy. See "How do I crash out of the install script?" below.
This is another procedure involving manually editing files in the event of a lost root password, and is specific to SCO Unix 3.2v4.0 through 3.2v5.0.7 (and maybe 6). The location of the encrypted passwords depends on the security settings. Look in /etc/passwd, /etc/shadow, and /tcb/files/auth/r/root; one or more of these will be used depending on how you have security configured. Follow the procedure in part 1 above; instead of editing /etc/passwd, edit the appropriate file(s) from the above list, and delete the encrypted password field. Note that formatting is critical; while you can delete the contents of the field, you must not remove separators, and making seemingly minor errors such as leaving blank lines can cause problems. Save, shut down, and reboot. C2 security will complain about what you've done; to make it happy, run /etc/fixmog. You may also want to run /tcb/bin/integrity and /etc/tcbck.
This procedure will work for any variant of SCO Xenix or Unix. As above, boot from your emergency boot diskettes and
mount /dev/hd0root /mnt
to gain access to your hard drive's root filesystem. Now, run
/mnt/bin/chroot /mnt "/mnt/bin/passwd root"
(check the "chroot" man page for more info on how it works). As before, shut down and reboot. It has been reported that on 3.2v4.2 (and possibly others), this must be done in two steps:
/mnt/bin/chroot /mnt "/bin/su root" passwd
If it doesn't work with the quotes, try it without.
If you don't have luck with anything else, consider installing onto a new hard drive and then mounting your original drive as a secondary.
You probably cannot do this with Linux! See http://aplawrence.com/SCOFAQ/FAQ_scotec1linuxfs.html
See http://aplawrence.com/SCOFAQ/FAQ_scotec6recoverdrive.html for mounting the original drive as a secondary, then proceed with the instructions above.
NOTE: If you have trouble here, be sure to read ALL the comments for alternative ways to make the password changes!
(if you don't have a boot disk, see How can I download a boot disk?)
On OpenServer Release 5, boot from the boot diskette, and at the Boot: prompt, type
This is not an undocumented option to the "boot" command, but rather a special line in /etc/default/boot on the installation diskette - so you can't use it from anywhere but your installation boot diskette.
Some later CD's have this also. Se Lost Password OSR5 for an example.
To get to your hard drive, you may need to create the appropriate device node:
mknod /dev/root b 1 42 fsck -ofull /dev/root mount /dev/root /mnt
Mike Pope commented:
What I did was to break out to the shell, run divvy and give the filesystems names. At that point a device node was created and I was able to proceed.
For older SCO Unix/Xenix/ODT releases, wait until the question early in the process that asks you what your keyboard type is. For character-mode installations, this is a regular textual prompt; for ODT, it's a box in a curses-style installation program. How to break out at this point depends on the OS. Under Xenix, press Del. Under Unix, type "shell" and press enter. Under ODT, press Control-A.
If you don't see that on a 3.2v4.2, you'll see:
1. Initial Install 2. Update 3. Exit
and THAT is where you'll type "shell".
On the old systems, you haven't got much until you get the hard drive mounted. No "ls" for example, so "echo /dev/*" is the best you can do. Once the drive is mounted, you can do "/mnt/bin/ls" etc.
How can I generate and save a debug logfile for an SCO OpenServer 5 installation or upgrade (not strictly related but worth reading :-)
For 5.0.5, use "tools" at boot from CD, and press F8 at the keyboard selection screen.
Should that happen, you can reconstruct it from the information in /tcb/files/auth. A script to do that is at /etc/passwd is missing or 0-length; can I re-create it from the user information in the tcb directories?.
If you found something useful today, please consider a small donation.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2015-01-08 Tony Lawrence