LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Yet another need to access a forgotten root password (https://www.linuxquestions.org/questions/linux-newbie-8/yet-another-need-to-access-a-forgotten-root-password-826020/)

gvaught 08-13-2010 10:32 AM

Yet another need to access a forgotten root password
 
Okay, I have read the other threads (nearly a dozen or so) and nothing of use has come from it. I have tried:
  1. booting into single user mode (using '1' and 'single' in my bootloader edits) and it still ends up kicking me to the 'myBox login:' prompt
  2. booting from a live-CD with no luck - seems my CD drive is hosed, or the system just won't boot the CD

This is a system I set up, literally, years ago, with no need to touch it. It was originally set up as a file server, running SAMBA. I am wanting to add CUPS to it, and possibly a web server if it will handle the load.

Currently, it is running Debian 4.0 without a GUI.

My next step, if I can't get into the root account, is to install a new OS (and try to salvage the file shares that exist). I just would rather keep the install that I have, but I need to hack/crack or change my root password.

Help???

sem007 08-13-2010 10:42 AM

Code:

but I need to hack/crack or change my root password.
I am not hacker/cracker. ;)

edit grub at boot prompt -> edit kernel line and append "init=/bin/bash" and boot machine.
it will boot machine and give command prompt then you can change root password.

tested on ubuntu 10.4 and debian lenny.

hope this help.

gvaught 08-13-2010 10:56 AM

Very cool - yet, I get the following prompt:
Code:

root@(none):/#
and when I attempt to change the password, I get
Code:

bash: passwd: command not found
and I've tried BOTH of the following, with the same result
Code:

root@(none):/# passwd

root@(none):/# passwd root

any other suggestions or ideas?

sem007 08-13-2010 11:00 AM

Give the full path of passwd command

Code:

/bin/passwd
/usr/bin/passwd


gvaught 08-13-2010 11:12 AM

You are good, my friend, but this seems to be eluding both of us.

@ /bin there is no passwd
@ /usr there is no ./bin (or I can't see it in this mode)

The /bin directory has a limited (approx. 90) number of commands available.
The /usr directory is (as far as this mode is concerned) empty.

It seems that in order to access the directories I need, I need to be logged in as 'root@myBox' rather than 'root@(none)'.

Or my system is hosed and I just haven't been able to accept that, as yet.

HasC 08-13-2010 11:22 AM

perhaps you need to mount your /usr directory before you get "passwd"?

gvaught 08-13-2010 11:30 AM

@HasC -
excellent recommendation!!! Now I've gotten to /usr/bin - and can run the passwd command.

Issue is here is what I get:
Code:

root@(none):/usr/bin# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token lock busy
passwd: password unchanged

Any ideas what that means or how to correct it?

Seriously, I want to thank you guys for taking the time to work with me.

PTrenholme 08-13-2010 12:00 PM

Can you edit /etc/sudoers in the mode you've gotten to by the init=/bin/bash mode? Perhaps you could create a new user and give that new user full sudo access. Then log in to that user and do a sudo passwd to change the root password.

But first, check that /var is mounted with write permission for "root." The "lock" may be being reported as busy because /var/lock is not writable.

malekmustaq 08-13-2010 12:52 PM

gvaught,

Run a live CD. Try the trick:

Mount your old root drive. Edit /etc/passwd and add a new sudo user by editing /etc/sudoers

Reboot into the old debian and find out if you can log in as a new sudo user. If you can then you will be able to do anything there as root. BTW you may need to delete some cached lock files first.

Good luck.

HasC 08-13-2010 04:40 PM

Quote:

Originally Posted by malekmustaq (Post 4065419)
gvaught,

Run a live CD.

The OP stated that he couldn't use a LiveCD

SalmonEater 08-13-2010 06:59 PM

HalC was getting you there;
Thanks to anticapitalista at anitX forums:

1. Append ‘init=/bin/bash’ {as done before}
2. Press Enter
3. Type mount -n -o remount,rw / (at prompt)
4. passwd
5. Follow steps to give yourself a new root password
5. reboot

malekmustaq 08-13-2010 08:22 PM

Quote:

Quote:
Originally Posted by malekmustaq View Post
gvaught,

Run a live CD.
The OP stated that he couldn't use a LiveCD
Ooops!

Yes indeed. Sorry.

Either I was drowsy or I was sleeping when I made the post.

May you have luck.

sem007 08-14-2010 12:29 AM

Quote:

Issue is here is what I get:
Code:

root@(none):/usr/bin# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token lock busy
passwd: password unchanged

Any ideas what that means or how to correct it?
Mount your ROOT filesystem as rw and try again.

konsolebox 08-14-2010 01:36 AM

Hmm... For a system with physical access that would be a pretty easy way to... never mind :D. I think remounting the system as rw as SalmonEater has said will do the trick. Please don't forget to mark this as solved when you already find it correct.

btmiller 08-14-2010 04:06 PM

Make sure the root filesystem is mounted read-write before running password:

mount -o remount,rw /

edit: oops sorry for the late reply ... I had an old version of the thread in my broswer cache,


All times are GMT -5. The time now is 04:52 AM.