Clan x86

Technical (Development, Security, etc.) => Unix / Linux Discussion => Topic started by: Joe on September 21, 2005, 05:40:12 PM

Title: Uh oh, forgot root password
Post by: Joe on September 21, 2005, 05:40:12 PM
Yep. Forgot the root password to cave. =(.

Does anyone know any way I can get it back? I have physical access to the box, so using a startup CD is no problem at all.
Title: Re: Uh oh, forgot root password
Post by: Blaze on September 21, 2005, 06:16:45 PM
Wiping Drive - 27% complete...
Title: Re: Uh oh, forgot root password
Post by: Newby on September 21, 2005, 07:19:54 PM
Eh, start the box with the boot CD, get to a shell, mount your drive, and uh, /etc/passwd / /etc/shadow <-- play with those files.

Otherwise, dunno.
Title: Re: Uh oh, forgot root password
Post by: Eric on September 21, 2005, 08:01:40 PM
IIRC, can't you just setpwd in single-user mode?
Title: Re: Uh oh, forgot root password
Post by: Newby on September 21, 2005, 08:43:22 PM
Quote from: LoRd[nK] on September 21, 2005, 08:01:40 PM
IIRC, can't you just setpwd in single-user mode?

passwd <username> works too, I think. But you have to be root, so eh
Title: Re: Uh oh, forgot root password
Post by: Quik on September 21, 2005, 08:57:15 PM
Did you have the insite to give yourself sudo priviledges?
Title: Re: Uh oh, forgot root password
Post by: mynameistmp on September 21, 2005, 09:19:25 PM
When you get to your LILO prompt:

Quote
LILO: linux init=/bin/bash

Instead of starting /sbin/init and proceeding with the usual /etc/rc.d/* procedure the kernel will just give you a shell. Not of much use to you, the hdd is mounted read only since it never had a chance to get checked and remounted read/write.

Quote
# mount -o remount,rw /

Now you can use passwd to change your password. Don't reboot yet. Since init isn't running there is no process in place for safely taking the system down. remount the root filesystem again.

Quote
# mount -o remount,ro /

Reboot.

Btw, this works on any linux system running LILO as a boot manager, so if ever you have console access to someone's box...
Title: Re: Uh oh, forgot root password
Post by: Quik on September 21, 2005, 09:40:56 PM
Ahh, so this is what you were talking about. So many neat tricks :p
Title: Re: Uh oh, forgot root password
Post by: mfqr on September 21, 2005, 10:13:54 PM
a more fun way would be to backup all ur stuff and rm -rf /*.
Title: Re: Uh oh, forgot root password
Post by: Joe on September 22, 2005, 07:46:51 AM
QuoteWhen you get to your LILO prompt:
I don't use LILO. =(
Quotea more fun way would be to backup all ur stuff and rm -rf /*.
...................

@Quik: I have sudo privlidges. I guess why it didn't work is because I was doing su instead.

EDIT -
joe@dave:~ $ sudo passwd root
Password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Title: Re: Uh oh, forgot root password
Post by: mfqr on September 22, 2005, 04:56:38 PM
Quote from: Joe[e2] on September 22, 2005, 07:46:51 AM
QuoteWhen you get to your LILO prompt:
I don't use LILO. =(
Quotea more fun way would be to backup all ur stuff and rm -rf /*.
...................

@Quik: I have sudo privlidges. I guess why it didn't work is because I was doing su instead.

EDIT -
joe@dave:~ $ sudo passwd root
Password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

You are no fun  :o.
Title: Re: Uh oh, forgot root password
Post by: Quik on September 22, 2005, 06:58:35 PM
Quote from: mfqr on September 21, 2005, 10:13:54 PM
a more fun way would be to backup all ur stuff and rm -rf /*.

Don't say that, ever agian. You sound like c0n.
Title: Re: Uh oh, forgot root password
Post by: Krazed on October 06, 2005, 07:56:12 PM
Quote from: Quik on September 22, 2005, 06:58:35 PM
Quote from: mfqr on September 21, 2005, 10:13:54 PM
a more fun way would be to backup all ur stuff and rm -rf /*.

Don't say that, ever agian. You sound like c0n.

*cough*... Anyway, That's a neat trick tmp.
Title: Re: Uh oh, forgot root password
Post by: Quik on October 06, 2005, 09:04:07 PM
Quote from: Krazed on October 06, 2005, 07:56:12 PM
Quote from: Quik on September 22, 2005, 06:58:35 PM
Quote from: mfqr on September 21, 2005, 10:13:54 PM
a more fun way would be to backup all ur stuff and rm -rf /*.

Don't say that, ever agian. You sound like c0n.

*cough*... Anyway, That's a neat trick tmp.

Yeah, I hint oh-so-subtle. Oh, and nice bump for what a pointless post. -1 ;)
Title: Re: Uh oh, forgot root password
Post by: Krazed on October 08, 2005, 08:25:57 AM
It was only 10 days! I don't wanna hear it.
Title: Re: Uh oh, forgot root password
Post by: zorm on October 10, 2005, 05:34:33 PM
Its also rather easy if you plan to use a liveCD. Just boot with it and then mount your hd. After that chroot into it and use passwd and tada.