Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Aug 2002 04:15:47 -0700
From:      Darren Pilgrim <dmp@pantherdragon.org>
To:        Desmond Lee <desmond.lee@shaw.ca>
Cc:        freebsd-newbies@freebsd.org
Subject:   Re: can no longer log into the machine :(
Message-ID:  <3D4E5E63.A016CD71@pantherdragon.org>
References:  <CMEMLGKEKMLLFOICILNMEEFKCBAA.desmond.lee@shaw.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Desmond Lee wrote:
> 
> Hi Darren
> 
> Thanks for your reply.
> 
> Yes, i think you're right. I've messed up the /etc/master.passwd and
> /etc/group files.
> 
> I haven't run pwd_mkdb command yet, so i'll look in the /var/backups for the
> original master.passwd so that i can copy it back into the /etc/ directory.
> What do you mean when you say:
> " you may still be able to rebuild using /etc/passwd and /etc/spwd.db."
> How can i rebuild using the files mentioned above?

/etc/passwd contains a copy of master.passwd, with * in place of the
password hashes.  spwd.db is a BDB hash of master.passwd.  The idea is
to copy /etc/passwd to master.passwd, then use a hex editor to look at
the contents of spwd.db and copy the hashes back into the new
master.passwd file.  You can probably find a script to "unhash" spwd.db
for you.

> I'm not sure what you mean when you say:
> "make sure you updating the CVS tags in those files.  If master.passwd gets
> changed, you need to propagate those changes to the other password files by
> saying `pwd_mkdb -p /etc/master.passwd`"

That was two seperate thoughts.  I didn't format my email well.

CVS tags are those lines in text files that look like this:

# $FreeBSD: src/etc/master.passwd,v 1.25.2.6 2002/06/30 17:57:17 des Exp $

mergemaster scan and compares these lines first.  If the live CVS tag
matches that of its new counterpart, mergemaster assumes the files are
the same and skips over it.  If you don't update these lines when you
hand-merge files, then the next time you run mergemaster, it will tell
you that your file is still out of date when it probably isn't.

> yes,... i know that backing up is important, i didn't know that you should
> run 'mergemaster -p' before you execute buildworld. The book i was reffering
> to didn't mention mergemaster untill after doing the 'make installworld' in
> the next section of the chapter. Some of the things you can't really learn
> from a book, you have to actual go out there and do it :(

That's the post-build mergemaster, which is different.  Running
`mergermaster -p` causes mergemaster to compare just those files that
must be up to date in order for the make world process to suceed.
From mergemaster(8):

-p          Pre-buildworld mode.  Compares only files known to be essen-
            tial to the success of {build|install}world, including
            /etc/make.conf.

Running `mergemaster` will build a full temproot tree and go through
whole set of files.  Even if you do `mergemaster -p` before the build,
you still need to do this after installworld.

> Anyways, i can't even log into the machine right now so i can't even try
> what you told me to do... do you have any suggestions?

Use the console and boot to single-user mode.  This will bypass logins
entirely, unless you editted /etc/ttys and changed the console line
from "secure" to "insecure".

> Also, is there any way i can resotre all the files from my /etc/ dir?

If you wiped out your entire /etc, you can get back the as-installed
files in multiple ways.  The fastest and easiest is to get them from
CD set's live filesystem CD using a tar | tar command.  Another
relatively simple way is to use CVS.  The /etc files are the src-etc
collection.  /etc/sshd/{ssh,sshd}_config are part of src-crypto.  You
were coming up from 4.3-R, right?  You can pull down the specific
4.3-R source tree by specifying tag=RELENG_4_3_0_RELEASE in your
supfile.

> Are
> the orignial /etc/* files in /var/backups so that i can just copy them back
> to /etc/?

No, just the really important ones. :)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D4E5E63.A016CD71>