Linux - Newbie This 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! |
| Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-14-2007, 03:18 AM
|
#1
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Rep:
|
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?
|
|
|
|
07-14-2007, 03:20 AM
|
#2
|
|
Senior Member
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079
Rep:
|
there is a grub cheatcode that allows you to log into root without the root password, I forget what it is but some googling should turn it up
|
|
|
|
07-14-2007, 03:51 AM
|
#3
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Original Poster
Rep:
|
I do not have Grub, I have LILO.
Hmm, I wonder if you can do that in LILO.
Anyway, probably easier just to edit the "/etc/shadow" on my new system. Problem is I can't tell where it is, and I'm only looking at the one on the DVD.
|
|
|
|
07-14-2007, 03:58 AM
|
#4
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Original Poster
Rep:
|
Found a link, we'll see what happens.
Thanks, Ace, I didn't know you could do anything like that. Actually, that's scary...anyone could wipe out your password when you're not looking...granted, you can do the same back!
For anyone else with this same question, the link is:
http://linuxgazette.net/107/tomar.html
And, for LILO, it says:
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.
|
|
|
|
07-14-2007, 04:04 AM
|
#5
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Original Poster
Rep:
|
No go on above cheat code.
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:
Quote:
* 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?
Last edited by ShellyCat; 07-14-2007 at 04:16 AM.
|
|
|
|
07-14-2007, 12:01 PM
|
#7
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Original Poster
Rep:
|
That is what I want to do, but I don't know how.
Using the link above, I see the person was directed to do the same thing I am trying to do:
Quote:
|
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?
|
|
|
|
07-14-2007, 12:29 PM
|
#8
|
|
Member
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83
Rep:
|
Quote:
|
Originally Posted by ShellyCat
I am finding only my DVD's "/etc/shadow". So where is the computer's filesystem mounted when I boot into the DVD?
|
Once the DVD is booted, I'll assume you should looking at your desktop. Is there a hard drive icon for you to browse? If so, you should be able to find etc/shadow.
Otherwise, I'd open up a terminal shell, and manually mount your hard drive if it's not already mounted. You can then traverse the mount point to find /<mount_point>/etc/shadow to edit.
|
|
|
|
07-14-2007, 01:00 PM
|
#9
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
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:
root::0:0:root:/root:/bin/bash
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"
|
|
|
|
07-14-2007, 01:00 PM
|
#10
|
|
Senior Member
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079
Rep:
|
in KNOPPIX just go to /media and that is were your harddrive is
|
|
|
|
07-14-2007, 03:01 PM
|
#11
|
|
Member
Registered: Jul 2007
Distribution: Slackware 13
Posts: 178
Original Poster
Rep:
|
The LinuxGazette solution worked [SOLVED]
http://linuxgazette.net/107/tomar.html
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:19 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|