LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help! I closed myself out of Linux! (https://www.linuxquestions.org/questions/linux-newbie-8/help-i-closed-myself-out-of-linux-20048/)

J_Szucs 05-02-2002 02:42 PM

Help! I closed myself out of Linux!
 
Please help me, suddenly I closed myself out of my Linux!
When logged in as root, I typed 'passwd' without any user names.
Then I got the 'passwd:' prompt, and here I realized that I did a mistake.
Not knowing what is the best way to leave the 'passwd:' prompt, I decided to type in two different passwords, which, in my hopes, should have resulted in an error message and leaving the 'passwd:' prompt.
So, the first time I pushed some random keys and ENTER. Linux told me that the password is too short, and, unfortunately, gave me back the "passwd:' prompt. Then I typed in some other random keys and ENTER. For my astonishment, Linux told me: 'password changed'. I do not know how could I change the password this way, since I only typed in two different random key sequences, the first of which was even too short to be taken into account, as Linux itself told me (Until now, I thought that I have to enter and re-enter exactly the same key sequences of the correct length to change an existing password - which was not the case this time). Naturally, I wanted to change the password back while I was logged in as root, but Linux got into an unusual operating mode: from that time on all messages and prompts were printed on the same line. Confused by this behaviour, I did an other mistake: pressed CTRL+ALT+DEL to restart the system. Since then I cannot login into my Linux box.
Could you please tell me how could I clear the unintentionally changed root password, or to what extent should I re-install Linux to get back the command over my Linux box? Is it possible to keep the data and programs installed during such a re-installation of Linux? (I know I could do a complete re-install, but then all data and programs would be destroyed).
Your urgent help is a must, as I need Linux, furthermore, I can only browse the NET under Windows and IE in the meantime, which I hate. (My mouse does not feel well in Window$, either: it seems to limit its functionality to one single window on the screen and other windows can only be controlled by the keyboard - a thing that never happened in Linux and often happens in Windows nowadays.)

trickykid 05-02-2002 02:48 PM

boot into single user mode.. change password for root there with the passwd root command.....

J_Szucs 05-02-2002 02:51 PM

Wow!
 
But how to boot into single user mode?

trickykid 05-02-2002 02:56 PM

if your using lilo... at lilo prompt type: Linux Single or init 1

J_Szucs 05-02-2002 03:30 PM

No success
 
I use lilo, but it did not help:
When I type 'Linux Single', Linux gives me 'szj login:' prompt, and I can do nothing since I do not know the root password.
When I type 'init 1' Linux prints an error: 'no such image', then asks for the root password, which I do not know any longer.
I always started Linux as root from the beginning as I read somewhere that I may have difficulties in establishing dial-up connection on a normal user account (later I came to know that it is not true, but I was too lazy to change it and it was too comfortable to be root). I do not even know if I ever created any other user account and what password it may have. Maybe I always used a single user account and thus closed the last door?

AutoBot 05-02-2002 04:10 PM

Are you sure it actually changed the password, you may have tried this or not but try simply hitting enter when it asks for the password. Probably will not work but was just a thought :)

J_Szucs 05-02-2002 10:21 PM

Yes, I tried just hitting ENTER but it did not work.

JimKyle 05-02-2002 10:49 PM

If you have an emergency boot floppy, you can boot from it instead of through Lilo. You should be able to get into Single-user mode with it.

If that doesn't work, use a Google search to find the home page for "tomsrtbt" and download the Windows package of that system. It's a single-floppy Linux system complete with all utilities, and you can create it from within Windows. Then use it to boot, mount your hard drive as "/mnt/fix" or some similar name that's not in the file system, and from there use vi to edit /mnt/fix/etc/passwd. Delete the string of garbage-looking characters between the first two ":" characters on the line for "root" and save the file. Then reboot normally without the floppy, and you should be able to log in as root with no password at all. From there you can restore your original password.

Hope this helps. The procedure is spelled out in several of the introductory books, except for the use of "tomsrtbt" to get access to the file system without a normal login...

Calum 05-03-2002 08:34 AM

what i have to say will not help you at all, but i just wanted to say that all the guides et c i have read about user admin state right off the bat that the first thing you should do is create a non root account, and then never use root at all. When you need to do something as root it is incredibly easy to su to root, remembering to exit out again afterwards.
Sorry, again, it's not meant to be condescending, just an object lesson to any other readers who may be heading for the same problem...

J_Szucs 05-03-2002 11:24 AM

Thank you Jim!
 
Your tip worked, I am back in my Linux again!

As for Calum's note: you are absolutely right, but as I mentioned here, I am too lazy to change a practice that works and is comfortable. (Strange, but now, when this acciddent happened I was about to create some sample accounts to establish and test a multi-user backup system.) Just to reassure you: I would not recommend anyone else the practice I follow, moreover, when I did installations for my colleagues (whom I try to convince to use Linux at home) I always created the correct user's accounts and recommended them to use that instead of root.

JimKyle 05-03-2002 12:01 PM

Glad to know it did! I've not had to use the trick myself (yet) so it was mostly theoretical...

TomG 08-05-2002 09:39 PM

I know this is an old thread, but there is something that is bugging me about it, and I'm wondering...

Would the procedure mentioned by JimKyle work to get access to the root account by someone other than root? It seems to me that a way to stop that easily would be to not allow it to boot from a floppy, but what if you use a floppy as a boot disk, for example if you have Windblows on another partition? And, you would block yourself out from using a rescue disk if you disabled booting from a floppy.

Any comments? Am I just nuts? Is there some simple way to stop access that way?

:study:

neo77777 08-05-2002 10:35 PM

you can setup dual boot w/o floppy involved, but note if you are using a bootloader (which you should to dualboot) then there is still a possibility to boot into single usermode, unless you defined lilo or grub to boot directly to linux without a delay (this of course defeats the idea of dualboot), now there is still a solution - password protect a single usermode it is called creating trusted user profile - I found that Bastille http://www.bastille-linux.org can do it, but I was not successfull to figure out myself how to password protect single usermode w/o any third party soft, meaning I am still in search on how to create trusted user system profile.

trickykid 08-10-2002 01:02 AM

The safest way is to password protect the boot loader like lilo for example, then making it only readable by root so no one can view the password that is setup in the file as its usually not encrypted.
Then you would want to password protect the BIOS and make it so you can't boot to a floppy or cdrom so they can't get around the boot loader password prompt to gain root access.
But of course they can always reset the BIOS by pulling the battery on board to reset any passwords setup, so if your really paranoid, then make sure the case has some sort of locking device.
And last, don't forget any of the passwords you setup and use, then you won't have any problems... ;)

Neur0tek 08-15-2002 03:09 PM

GNOME 2.0 got eeeeevil
 
I don't know how it happened at all but once I put GNOME 2.0 on all of my logins went to hell. I just wanted to say that going through the whole forums and piecing together answers from posts on this forum really helped allot. Thank you to all of the answer givers.
By the way....MAKE A BOOT DISK IF YOU ARE INSTALLING A NEW SYSTEM (RH 7.3) BECAUSE IT WILL SAVE YOUR BACKSIDE!

linux single
passwd

was the fix.:D


All times are GMT -5. The time now is 10:31 PM.