You are not logged in.

#1 2009-03-17 14:09:00

wickyd
Member
Registered: 2007-02-21
Posts: 23

[Solved] Reset root password

Hi folx

I need to reset the root password. I tried going into GRUB and appending the relevant line with:

(1.) single
(2.) 1
(3.) single init=/bin/bash

Result:
(1.) asked for root password during boot
(2.) asked for root password during boot
(3.) didn't get that far as it went into kernel panic

I downloaded Ubuntu 8.10 desktop to use as a live CD, but that didn't work as the CD just dumped me into an initramfs session.

How am I supposed to reset my root password?

Thank you, wickyd.

Last edited by wickyd (2009-03-19 07:38:14)

Offline

#2 2009-03-17 14:15:03

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,390
Website

Re: [Solved] Reset root password

Offline

#3 2009-03-17 14:41:50

lilith2k3
Member
From: Osnabrueck
Registered: 2008-09-01
Posts: 25

Re: [Solved] Reset root password

chose another live-Distro (e.g. knoppix)
chroot into your system an use

passwd

as usual

Offline

#4 2009-03-17 14:55:44

wickyd
Member
Registered: 2007-02-21
Posts: 23

Re: [Solved] Reset root password

Allan: Thanks but this is exactly my point .. the tips suggested there don't work for Arch Linux.

I never get to a bash shell because Arch asks me for the root password before I can enter single user mode.


lilith2k3: I don't think that will solve the problem as this is very old hardware. I couldn't even install from CD, I had to install via FTP.

Is there any other way to do this?

Offline

#5 2009-03-17 15:10:04

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

How about using an editor instead. init=/usr/bin/nano?

Offline

#6 2009-03-17 15:28:44

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: [Solved] Reset root password

if you can boot from a cd, try a minimal cd like the LFS live cd or DSL... if not, maybe a USB drive image?


.:[My Blog] || [My GitHub]:.

Offline

#7 2009-03-17 15:46:27

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

Use a floppy distro.

Offline

#8 2009-03-17 16:36:30

wickyd
Member
Registered: 2007-02-21
Posts: 23

Re: [Solved] Reset root password

Procyon: This looks very promising, but something isn't working ...

These are the steps I took:

1. Change grub kernel line from ro to rw (or else nano can't write files) and append single init=/usr/bin/nano.
2. nano loads successfully.
3. edit /etc/shadow and remove root password.
4. reboot server and attempt to login, but server claims the login is incorrect.
5. reboot again into nano and discover /etc/shadow is 0k in size.

Repeat steps above with the same result.

Any idea what is going wrong?

Offline

#9 2009-03-17 17:22:22

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

Completely empty? Did you remove the field after the password too? (there is a days since 1970 field right after it) Maybe completely clearing the shadow file is a result of an invalid entry.

Offline

#10 2009-03-17 18:15:30

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

This looks interesting: http://www.cyberciti.biz/tips/recoverin … -file.html

Maybe you can use init=/usr/sbin/pwconv

Offline

#11 2009-03-17 18:36:17

SkonesMickLoud
Arch Linux f@h Team Member
From: The D of C
Registered: 2008-09-20
Posts: 178

Re: [Solved] Reset root password

Silly question, I know, but do you have sudo permission?

You can reset the root password with your user password, if you've got sudo access.

Offline

#12 2009-03-18 06:28:50

wickyd
Member
Registered: 2007-02-21
Posts: 23

Re: [Solved] Reset root password

Procyon: Yes, it is completely empty. I copy the file shadow- (backup file) to shadow which ends up being 145bytes after editing. However, once I reboot the file is 0bytes. It is as if the write is not permanent.

Procyon: Thank you again for that link, unfortunately that link assumes that init=/bin/bash works but my machine goes into kernel panic when I append that.

Can someone else please confirm if appending single init=/bin/bash works for them.

Is it peculiar to my hardware or do other people also experience a kernel panic while trying that route?

SkonesMickLoud: I know that would seem the obvious route, but I can't use Sudo to fix the problem.

Offline

#13 2009-03-18 09:08:39

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

I see, then the pwconv won't make a difference.

When you do init=/usr/bin/nano, what happens when you quit nano?

Maybe you need to force sync the hard drive using alt+sysrq+s (after you enabled it) or opening /proc/sysrq-trigger with nano, and writing s to it.

BTW if you use vim, can you do :! bash?

Offline

#14 2009-03-18 11:31:03

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [Solved] Reset root password

What about single user mode ?
When you get to grub, press e to edit an entry, select the kernel line, press e again and append the word single and then press b to boot. Hopefully that should get you to a root prompt so you can reset the password.

Last edited by moljac024 (2009-03-18 11:34:34)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#15 2009-03-18 12:47:41

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: [Solved] Reset root password

moljac024 wrote:

What about single user mode ?
When you get to grub, press e to edit an entry, select the kernel line, press e again and append the word single and then press b to boot. Hopefully that should get you to a root prompt so you can reset the password.

But you did read his first post, didn't you?

Offline

#16 2009-03-18 13:58:02

SiC
Member
From: Liverpool, England
Registered: 2008-01-10
Posts: 430

Re: [Solved] Reset root password

Easiest way would be to download either the USB image for Arch, or the LiveCD.

Boot from it.

Mount your root partition at say /mnt/root.

chroot into it using chroot /mnt/arch /bin/bash

run passwd.

Your root password should now be reset. Hopefully.

Offline

#17 2009-03-18 14:19:46

Hrod beraht
Member
Registered: 2008-09-30
Posts: 186

Re: [Solved] Reset root password

I used the procedure in the wiki: Password Recovery.

Bob

Offline

#18 2009-03-18 14:25:46

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [Solved] Reset root password

Offline

#19 2009-03-18 14:38:48

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

init=/usr/bin/passwd?

Offline

#20 2009-03-18 14:44:22

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] Reset root password

Is it possible you edited the /etc/shadow of the initrd?

Offline

#21 2009-03-18 14:50:38

quarkup
Member
From: Portugal
Registered: 2008-09-07
Posts: 497
Website

Re: [Solved] Reset root password

->  if you are using an ext2 or 3 (or 4 maybe) or reiserfs

->  if you're dual-booting with windows, there are apps to access the partition/disk with the linux os. access it then change it.


If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.

Offline

#22 2009-03-18 16:28:04

Napaim
Member
From: Scotland
Registered: 2009-03-09
Posts: 26

Re: [Solved] Reset root password

I'd have thought a usb boot + chroot or mounting the arch fs would work.

Offline

#23 2009-03-18 16:46:45

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [Solved] Reset root password

this has all been discussed before - ad nauseatum

1) boot up with _any_ live cd
2) mount your root filesystem as - say - /mnt/fs
3) vi /mnt/fs/etc/passwd
       change the first line to:
       root::0:0:root:/root:/bin/bash
4) unmount /mnt/fs and reboot
5) you can now log in as 'root' with no passwd
6) pwconv && passwd     (now set new password)

<edit>
With all due respect - chroot is _not_ the way to go.
In order to actually _set_ a new password, you have to run the same kind of
authorization as in your present system - it may be different for different distros.
</edit>

Last edited by perbh (2009-03-18 16:49:01)

Offline

#24 2009-03-18 17:07:00

xd-0
Member
From: Sweden
Registered: 2007-11-02
Posts: 327
Website

Re: [Solved] Reset root password

Try to use init=/bin/bash and run single user mode.

Offline

#25 2009-03-18 21:21:12

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [Solved] Reset root password

bluewind wrote:
moljac024 wrote:

What about single user mode ?
When you get to grub, press e to edit an entry, select the kernel line, press e again and append the word single and then press b to boot. Hopefully that should get you to a root prompt so you can reset the password.

But you did read his first post, didn't you?

Ooops..


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

Board footer

Powered by FluxBB