From David Stebbins on Mon, 14 Dec 1998
Hey Jim, After reading the letters to you and your responses I feel kind of silly writting to you with my little problem, but here it is. I am a very, very new linux 5.2 redhat (Macmillan) user and after installing the OS and establishing a user account for myself I have not been able to login as the root user. I type the same exact password that I used when I set the system up (as the root uesr), but cannot get back in (...very frustrating). perhaps you have a solution for me? I was logging in as "root" (w/o the " marks) and then just entering my password. What am I doing wrong? Thanks David
Is this at the console?
If not, it's probably just securetty (read the man page in section 5).
Can you login as a normal user and then use the 'su' command to attain 'root' status?
If not then you probably have lost or forgotten the password or corrupted your /etc/passwd file. In those cases you can boot from a floppy diskette or boot and issue the 'init=/bin/sh' LILO option (as I described last month) to get into the system in single user mode without requiring any password (requires console access, obviously).
Keep in mind that the passwords are case sensitive. You must remember which letters you typed in [Shift]-ed mode and in lower case. Also, if you look at you /etc/passwd file you shouldn't seen any blank lines, any comments, and any "junk" characters (control characters, etc). Read the passwd(5) on any working system to get the details of proper 'passwd' file formatting --- or just copy one from your boot floppy and recreate the accounts as necessary.
Note, if you create a new passwd file you may create "orphan" files in this process, as your new account names might have mismatches to the old numeric UID's and GID's under which these files were created. The easiest way to fix that on a small system is to look at the numeric UID's of the files (any "orphan" file will show up with a numeric owner during an 'ls -l' and you can use the command 'find / -nouser -ls' to list all of them) --- then using your personal knowlege of who these files belong to, set their /etc/passwd account to match those numerics.
Unfortunately the full details of all of this are far to complicated to describe in detail at this hour (it's 3:00am my time, I just got back from Boston, Massachusetts from the USENIX/SAGE LISA Conference).
Once you get your system straightened out, make a backup copy of your /etc/passwd and /etc/group files --- just mount a floppy and copy them to it. That will make restores much easier in the future (even if you you have a full backup system in place it's often handy to restore these files before trying the rest of your restore --- some versions of 'tar' and 'cpio' for example don't restore files under numeric UID's and GID's -- they'll "quash" the ownership to root.root for all of them!
If you really get stuck, call my number (800) 938-4078 to leave voice mail. It would make more sense to walk you through the recover than to type up every possible recovery technique in this message.