Messages in this thread |  | | Date | Wed, 15 Jan 1997 09:32:39 -0500 (EST) | From | "Richard B. Johnson" <> | Subject | Re: Single user mode |
| |
> > > > George B. Winston IV wrote: > > Sorry for the lame question, but I think my system was hacked and all > of the passwords changed. I can't even log-in as root. > > Is it possible to boot in single user mode and change root's > password? If so, How do you boot in single user mode and change
Some distributors execute /bin/sulogin in "single user" mode so you will be challenged for a password even in single user mode. This will prevent you from logging in.
If you have SCSI, the problem that you describe is easy to fix. You connect your root hard disk to another Linux machine, mount it off from /mnt and fix any problems. You also might be able to do this with some IDE drive setups.
Otherwise, most distributions provide a boot disk that can be used to repair a damaged file-system. Usually there is some way to exit to a shell and perform whatever commands are necessary.
In your case, the idea is to mount the "previous" root file-system read/write and edit /etc/passwd. Just remove the root password, i.e., "::" instead of the ":JUNK:" that presently exists. If you use shadow passwords, you also have to execute pwconv to make the change take effect and pwconv only works on the "real" password file. Therein lies the problem. In this case, you have to rename the old password file (to save it) and the shadow file. Then copy the ones from your distribution disk.
NOTE: The most common reason why one can't log onto their own system from any account is that, from a previous edit of the password file, a BLANK LINE was accidentally put in the first record of /etc/passwd. You may find that your system was not hacked at all. Instead, you may have added an account and, while editing the file, accidentally included a blank line as the first element in the file! I don't know if this is a BUG or a FEATURE.
I spent several hours making a root file-system on a floppy. No RAM disk, just a floppy (yes it can be done). The time spent was worth it. I can break into any of my systems. Once you get "up", you might want to do the same thing. If you need such a root file-system, send me private email and you can download it from one of my servers, you would just copy the binary file directly to a 1.44 Mb floppy, make a boot disk that expects to mount /dev/fd0 as the root file-system... and away you go.
Cheers, Dick Johnson -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard B. Johnson Project Engineer Analogic Corporation Voice : (508) 977-3000 ext. 3754 Fax : (508) 532-6097 Modem : (508) 977-6870 Ftp : ftp@boneserver.analogic.com Email : rjohnson@analogic.com, johnson@analogic.com Penguin : Linux version 2.1.21 on an i586 machine (66.15 BogoMips). Warning : It's hard to remain at the trailing edge of technology. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|  |