"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, linux-questions-only@ssc.com
LinuxCare, http://www.linuxcare.com/


(?) Removing an OS

From Paully0529 on Sun, 30 Jan 2000

I recently received a laptop which has Red Hat 5.1 installed on it. I would like to remove this OS but have no idea what the login password is. Is there any way around this?

(!) You don't need a user/account password to remove any operating system. So long as you can control the boot sequence of the system (i.e. boot from floppy or CD) then you can boot up into something that will wipe out all that nasty stuff that you don't want on your new laptop's hard disk.
There are also ways for you do force a password change on a Linux box. I've described it several times --- but the basic sequence is something like this:
At the LILO: prompt type:
linux init=/bin/sh rw
... this will boot the system using the "linux" LILO stanza, and force the kernel to bypass the normal bootup process (by loading a command shell instead of the usual init process). It will also force the kernel to mount it's "root" filesystem in "read/write" mode.
You can then type:
mount /usr
... which might not be necessary, and thus might give a (harmless) error message.
Then type:
/usr/bin/passwd
... and provide a new password (which you'll need to repeat twice).
Next you can type the following commands (ignoring some possible, harmless warnings and errors):
sync
umount /usr
mount -o remount,ro /
exec /sbin/init 6
Of course those directions are for people who want to take over a Linux system and preserve the programs, configuration and data on it. In your case you could do something more like the following at the LILO prompt:
linux init=/bin/sh rw
... and when you get a shell prompt just use:
dd if=/dev/zero of=/dev/hda
... (assuming that Linux is on your primary IDE drive).
NOTE: This last command example will WIPE OUT EVERYTHING ON YOUR PRIMARY IDE DRIVE! It will scribble strings of binary zeros (ASCII NUL characters) all over the drive wiping out everything. Don't use this unless that's really what you want to do!
(Note: one some systems you might have to use some other "stanza" name other than "linux" --- hit a [Tab] key at the LILO prompt to see a list of options).
SysAdmins Note: If you want to prevent users from doing these sorts of things to their desktop systems (as a matter of policy for example) then you can set up a LILO password and mark the system as "restricted" in the /etc/lilo.conf file.
Of course this by itself will not be much "protection" -- you'll also have to mark the file as not readable by users other than root, restrict root access to the system, change the CMOS boot sequence to prevent booting from floppies, CD discs and other removable media, and set a CMOS/NVRAM password to prevent the users from changing the boot sequences back. On top of all that you'll have to pick a brand of PC/BIOS that doesn't have any known "backdoor" CMOS passwords and you'll have to lock the cases so that the users can't open them up to short the battery to clock chip leads, or otherwise reset the CMOS registers to their factory state. Those are all hardware security limitations of PCs, Macintosh and many of the other workstations. They are not OS specific issues.
With most operating systems, you can boot up off their installation media and readily wipe out whatever happens to be sitting on the system by simply answer some silly install program warning. (Early versions of MS-DOS were pretty stupid in that they would refuse to remove or overwrite "foreign" or "unknown" partitions in FDISK regardless of a users wishes. I don't know if they ever fixed that. I haven't installed any MS operating system on anything for several years).


Copyright © 2000, James T. Dennis
Published in The Linux Gazette Issue 51 March 2000
HTML transformation by Heather Stern of Tuxtops, Inc., http://www.tuxtops.com/


[ Answer Guy Current Index ] [ Index of Past Answers ] greetings 1 2 3 5
5 6 7 8 9
10 11 12 13 14 15 16 17
18 19 20 21 22


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Linux Gazette FAQ ] [ Next Section ]