[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with corrupted root password



On Thu, Jan 15, 2015 at 12:47:08PM +0100, mrr wrote:
> On 15/01/2015 01:00, Gary Dale wrote:
> >On 14/01/15 04:26 PM, Rob Owens wrote:
> >>On Wed, Jan 14, 2015 at 03:07:09PM -0500, Comer Duncan wrote:
> >>>I recently got wheezy up and running.  I installed xfce4 and like it.
> >>>
> >>>However, today in the process of trying to spawn a root terminal (in
> >>>Accessories) and going through a cycle of trying to get authorized but
> >>>being prevented by repeated complaints that the system password I
> >>>used was
> >>>not correct, I now find that I can not get logged in in single-user
> >>>mode!
> >>>I have thus royally screwed up.  So, how can I get the system password
> >>>changed to something new?
> >>>
> >>>Thanks for help and apologies for making such an error.
> >>Boot using a Live CD, then as root:
> >>
> >>mount /dev/sda1 /mnt/sda1 (or whatever device is your root partition)
> >>chroot /mnt/sda1
> >>passwd
> >I'd change the chroot command to
> >   chroot /mnt/sda1 bash
> >
> >to ensure you get the correct shell. System Rescue CD, for example, uses
> >zsh by default so chrooting with specifying the shell will get you a
> >not-found error.
> >
> >
> 
> Wouldn't it work too if you delete the root line in /etc/shadow ?
> When I say delete, I mean just the hash, you would leave a line:
> 
> root:
> 
I tried this with a test user and it worked.  But there are fields after
the password hash that remain.  My user's line in /etc/shadow looked like 
this:

junk::16450:0:99999:7:::

I was able to login as the 'junk' user without a password.  I wasn't
even asked for a password.  However, 'su junk' from my regular user
account did not work.

> And just for fun (well maybe I'll try this later) if you take your
> user hash in the same file and copy it in the place of the root
> hash, wouldn't root get the same password as the user one?
> 
I tested this too, and it worked for both a login and for su.

Thanks for the ideas!

-Rob

Attachment: signature.asc
Description: Digital signature


Reply to: