LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   root password recovery - Suse 10.2.1 (http://www.linuxquestions.org/questions/linux-newbie-8/root-password-recovery-suse-10-2-1-a-829680/)

warlynx 09-01-2010 04:22 AM

root password recovery - Suse 10.2.1
 
Hope you can help

Short version:

Ex employee logged into to box and changed the root password, trued to start in single user mode, but not coming right

Long version:

* Loaded up grub
* Typed the following in Boot Options:
init=/bin/sh
* Takes me to a prompt where I then enter the command "passwd"
* Returns with a "command could not be found" output

Tried changing the directories to /usr/bin and /sbin but didn't work either, any ideas?

TB0ne 09-01-2010 10:27 AM

Quote:

Originally Posted by warlynx (Post 4084518)
Hope you can help
Short version:

Ex employee logged into to box and changed the root password, trued to start in single user mode, but not coming right

Long version:

* Loaded up grub
* Typed the following in Boot Options:
init=/bin/sh
* Takes me to a prompt where I then enter the command "passwd"
* Returns with a "command could not be found" output

Tried changing the directories to /usr/bin and /sbin but didn't work either, any ideas?

Not sure what you mean by "not coming right", but instead of going through Grub, boot from your CD/DVD media. Go into "Rescue" mode. From there, you'll be able to mount the hard drive. You can try to run the "passwd" command from there (you'll be in as root at that point), or you can manually edit the /etc/shadow file, and remove the password for root.

And alternative is to find said ex-employee, and threaten them with bodily harm, until they tell you the password. :)

tracertong 09-01-2010 12:38 PM

First things first, I'd specify
Code:

init=/bin/bash
...as the shell. Be explicit. the system knows very little about itself at this stage.

That gives you a shell, and virtually nothing else, but the filesystem is still mounted read-only. So, next do this:
Code:

mount -o remount,rw /
That remounts the filesystem read/write.

Now
Code:

passwd
Set you password, and (important) remount as read-only:
Code:

mount -o remount,rw /
Hit the reset button.

Andrew Benton 09-01-2010 06:59 PM

Another option is to boot with a live cd, mount the partition your system is on in a folder somewhere and then chroot into it.
Quote:

Originally Posted by warlynx (Post 4084518)
* Loaded up grub
* Typed the following in Boot Options:
init=/bin/sh
* Takes me to a prompt where I then enter the command "passwd"
* Returns with a "command could not be found" output

That suggests that /usr is on a separate partition that has not been mounted. Mount everything in /etc/fstab with mount -a


All times are GMT -5. The time now is 05:08 PM.