[SOLVED] Need to recover or change root password. And must run "nano".
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Need to recover or change root password. And must run "nano".
I hate these darn laptop keyboards! I typed my password very carefully, but yet I must have typed it wrong.
I tried booting from the install DVD, but I don't really know where to find (or how to distinguish) the filesystem on my computer's installation. I looked in "/etc/shadow", but I am not looking at the correct one...that one has no password, so that must be the DVD one. How do I find the "/etc/shadow" on the installed system?
I am aware I won't be able to read the password in "shadow" because it is encrypted, but I should be able to just delete it, correct?
Related: How do I run "nano" from the DVD, but open a file on my own system?
Follow these steps to reset the password when using LILO:
* Reboot the system. When you see the LILO: prompt (see Fig. 1 below), type in linux single and press 'Enter'. This will log you in as root in single-user mode. If your system requires you to enter your root password to log in, then try linux init=/bin/bash instead.
* Once the system finishes booting, you will be logged in as root in single-user mode. Use passwd and choose a new password for root.
* Type reboot to reboot the system and then you can login with the new password you just selected.
If you have a new version of LILO which gives you a menu selection of the various kernels available press Tab to get the LILO: prompt and then proceed as shown above.
Whether I use "linux single" or "linux init=/bin/bash", LILO tells me "no image by that name".
Tried booting from DVD and entering "linux rescue" there, same error.
Tried USB stick, but I'm not sure that the boot-disk creation on the USB even suceeded in the first place. Same error.
I will try Knoppix approach when I wake up (I am too tired now), but one thing I am confused about in the instructions is this:
* Type mkdir mountplace to create a directory called 'mountplace'. This is where we will mount the filesystem.
* Type mount /dev/hdaX mountplace, where /dev/hdaX is your root partition. More information on Linux partitions is available here.
My hard drive was "sda" (SCSI) in the partition table in fdisk when I created the partitions before install. It had 6 partitons (3 primary, 1 extended, 2 logical). Now, I only see "hda5" (which is not the Linux boot)! Any thoughts?
Using the link above, I see the person was directed to do the same thing I am trying to do:
Since you have physical access, boot Knoppix or any live Linux CD/DVD), open a terminal, and change the (liveCD) root password. Edit /etc/shadow (the liveCD one) and copy the hash to the /etc/shadow on the system root for the real system. You've just changed the password, the old fashioned way.
The problem is I can't tell where the DVD filesystem and my computer's filesystem are delineated. I understand Linux filesystems in general, but this confuses me, because I've never had to do it or deal with it after a system was installed.
I am finding only my DVD's "/etc/shadow". So where is the computer's filesystem mounted when I boot into the DVD?
When you boot from live CD, simply open a terminal and enter "fdisk -l". That will tell you where all your partitions are. You have to then figure out which one has the "/etc" directory. Once that is mounted, then go into /etc and find the "passwd" file. Edit this file to remove the "x" after the first ":". (Use whatever editor is installed--I use nano because its almost always there.) The edited file will look something like this:
save the file and reboot--you will now be able to login as root with no password.
One thing to be careful about: Suppose you have mounted the appropriate partition and "ls" shows that etc is there. To enter the etc directory, be sure not to do "cd /etc"--that would take you back to the /etc directory associated with your live linux). From the root level of the mounted partition, you would do "cd etc"
Thanks all. I couldn't do the solutions they suggested from the bootloader...every command I entered was interpreted as a boot image LILO thought I wanted it to look for.
As for the confusion about finding the proper /etc/shadow, that was because I was booting from my Slackware DVD. Need to use a "live" CD! (I did say I was tired. ) As for the "hda" vs. "sda" thing, well, I guess that's just the way it is -- the partition table uses "sda" to denote that the hard disk is SCSI, but apparently the live CD could care less. Using "hda2" worked just fine.
The instructions on LinuxGazette to mount and cd into the proper directory were perfect. My only complaint is the Knoppix Live CD doesn't have nano. VIM is very strange.
I deleted the hashed password, rebooted, logged in as root, and reset my password.