LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 05-05-2005, 10:45 AM   #1
k1ll3r_x
Member
 
Registered: Sep 2004
Location: Laredo, TX
Distribution: Debian 11
Posts: 164

Rep: Reputation: 30
Forgot root password


i tried reading some other threads, im using suse 9.1 and i tried the whole lilo grub thing, press this go to grub, and then look for linux or kernel=vmzlinux or something like that, but it didnt work, nothing did, i go on single user mode, and it asks me for the root password which im trying to recover since i forgot it if anyone knows ANY way to recover a root password, from suse 9.1 with out installing everything over again, plz id really appreciate some help
thanx
 
Old 05-05-2005, 11:05 AM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
first af all. are you sure you are doing it correct with grub?
All you need to do is to put a 1 at the end of the kernel line.
But some linux distros like slackware do have authentication even in init 1.

Anyway I'll tell you how I recovered today from a root password loss.
First of all, it's a lot easier to change the password that to find the old one.
(To find the old one you need to crack the encrypted value in /etc/shadow.)

1. Boot from a live CD. (any live cd)
2. mount your root partition from the live cd (make a directory and mount it in there):
Code:
mkdir /suse_installed
mount /dev/hdxx /suse_installed
3. backup your shadow file:
Code:
 chroot /suse_installed
cp /etc/shadow /etc/shadow.old
4.Edit the shadow file,
All the entries there are like this:
<username>:<encrypted_password>:bla:bla:bla:......
and remove the <encrypted_password>, to make it look like this:
<username>::bla:bla:bla:..................

5. save, type exit to exit the chroot, umount, reboot. The next time you reboot , root won't have any password.

after you login as root again, use passwd command to use a new password.
 
Old 05-05-2005, 11:09 AM   #3
PeteBourner
LQ Newbie
 
Registered: Apr 2005
Location: Dover, England
Distribution: Gentoo, Knoppix
Posts: 15

Rep: Reputation: 0
I don't think you can actually recover the password, but if you have a Linux LiveCD (e.g. Knoppix) you can bypass it instead.
Just boot up the LiveCD, then you can mount the partition(s) holding your SuSE installation and chroot into it.
Then you can reinstall lilo/grub.

I would recommend always keeping a copy of Knoppix, or some other LiveCD, to hand as they can be a real life-saver.
 
Old 05-05-2005, 11:09 AM   #4
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
Here are the instructions into breaking into your own system if you've lost your root-password. This is taken from an article I found in Linux Gazette, written by Mark Nielsen (http://www.linuxgazette.com/issue41/nielsen1.html).

This document assumes you are partitioned thusly:
/dev/hda1 swap
/dev/hda2 /
/dev/hda3 Dos

Author refers to Redhat 5.2 but this will work with subsequent versions (I've tested it), and should work for other distro's as well.

Steps:

1. Make system bootable from CD-rom (either in BIOS or use a boot floppy that will do so).

2. Put Linux Distribution CD into cd-rom drive and turn on computer.

3. Pretend to go through installation of distribution and after it asks you to put in the CD-rom and it gets to the next screen you can now go to the second console window.

4. Press Alt-F2, Alt-F3, Alt-F4, Alt-F5 and then Alt-F1. You should see the various screens with different messages. The one we want is Alt-F2.

5. Press Alt-F2.

6. Type "cd /tmp" and press enter. This takes us to a directory where we can make files, directories, etc...

7. Now we will make a temporary directory and a temporary device for the partition on the hard drive that we want to look at or edit. Type the following:
mkdir /tmp/my_dir
mknod /tmp/my_dev b 3 2 #the two is taken from hda"2"
above, so should be wherever your "root" partition is.
mount /tmp/my_dev /tmp/my_dir
df

8. "mkdir" makes a directory for us to mount the a partition to. "mknod" makes a device for 2nd partition on the master hard drive (hda2). This lets us "see" the partition. In particular, "b 3 2" means "b" is for block device, "3" is the master hard drive on the primary IDE controller and "2" means the second partition.
"mount" takes the device we can see; and puts it on top of the directory /tmp/my_dir.
df lets you see what filesystems are mounted and where.

Now we can iether edit the password file or perhaps something like turning off xwindows from starting up if you have a computer using xdm. Let's do the password

9. type: "cd /tmp/my_dir/etc" then "vi passwd"

10. You need to know how to use vi (a great editor found on almost every UNIX by default). "x" deletes a character, "i" inserts characters, "Esc" turns on and off command mode/insert mode, "wq!" writes, quits and ignores any problems withread-only files, "h" moves one character to the left, "l" one character right, "k" up one line, "j" down one line.

11. Now in the passwd file press "j" until you get to the line you want to be on "root" (for our example)
root:x:0:0:root:/root:/bin/bash # here we want to delete the "x" which is telling us the password is shadowed.
Now type "wq!" (without the quotes)

12. Now type "vi shadow"
You may see a line for root that looks like this
root:$1$Upkf7iIA$.nSNmn0MkoRP2srJsUx.0/:11321:0:999999:7:::
just delete everything between the colons to make it look like
root:::::::: # that's 8 (eight) colons after the word "root"

Now type "[Esc], :, wq!, and press enter" to write the file, quit and ignore read-only problems.

13. Now you're done editing the file, what is the problem now? If you reboot you will likely lose all of your changes. You must unmount the directory, THEN reboot.

14. Do this > "cd /tmp" > "umount /tmp/my_dir" > "df"

15. After ensuring you unmounted ok, press CTRL-Alt-Del to reboot. Also, take the cdrom out fo the cdrom drive. When your computer restarts I'd recommend having your BIOS boot off the hard drive rather than the CD-rom.

That's it, this is very useful in the case of lost/forgotten root passwords. But it's also good for fixing other problems when you just can't get it booting the right way. As I said, I plagarised the hell out of his article. But it was a great article and helped me out immensly. I hope Mr. Nielsen doesn't mind my copying his work for this forum.
 
Old 05-05-2005, 01:24 PM   #5
Kdr Kane
Member
 
Registered: Jan 2005
Distribution: SUSE, LFS
Posts: 357

Rep: Reputation: 30
If those suggestions don't work, search the forums for root, password and chroot.
 
Old 05-05-2005, 02:57 PM   #6
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
If none of these suggestions work there is a MAJOR problem. Good Luck and let us know how it goes.
 
Old 05-05-2005, 03:37 PM   #7
broch
Member
 
Registered: Feb 2005
Distribution: Slackware-current 64bit
Posts: 465

Rep: Reputation: 32
I have put together root password reset for SuSE
http://forums.suselinuxsupport.de/in...howtopic=14200
It is quite easy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
forgot root password ali_hammad Linux - Newbie 3 03-09-2005 10:46 AM
forgot root password ust Linux - General 5 07-03-2004 01:39 AM
I Forgot my root password Hamid Moradmand Linux - Distributions 4 06-02-2004 01:45 PM
Forgot Root Password Darthcoder Linux - Newbie 5 11-08-2003 03:23 PM
forgot root password samik_ban Linux - Newbie 3 10-16-2003 07:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration