From owner-freebsd-questions Sun Mar 2 7:23:15 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7506537B401 for ; Sun, 2 Mar 2003 07:23:13 -0800 (PST) Received: from sub21-156.member.dsl-only.net (sub21-156.member.dsl-only.net [63.105.21.156]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7645B43FBD for ; Sun, 2 Mar 2003 07:23:02 -0800 (PST) (envelope-from nkinkade@sub21-156.member.dsl-only.net) Received: from nkinkade by sub21-156.member.dsl-only.net with local (Exim 4.10) id 18pVIm-0003FO-00 for freebsd-questions@freebsd.org; Sun, 02 Mar 2003 07:22:56 -0800 Date: Sun, 2 Mar 2003 07:22:56 -0800 From: Nathan Kinkade To: freebsd-questions@freebsd.org Subject: Re: recover /etc/passwd from pwd.db Message-ID: <20030302152256.GK280@sub21-156.member.dsl-only.net> Reply-To: nkinkade@dsl-only.net Mail-Followup-To: freebsd-questions@freebsd.org References: <20030228195647.GA751@reiher.informatik.uni-wuerzburg.de> <20030302003128.GA7146@moghedien.mukappabeta.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aHoHdjwP6C+YV8GI" Content-Disposition: inline In-Reply-To: <20030302003128.GA7146@moghedien.mukappabeta.net> User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --aHoHdjwP6C+YV8GI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 02, 2003 at 01:31:28AM +0100, Matthias Buelow wrote: > I wrote: >=20 > >after the latest crash of 5.0-p2/i386, my /etc/passwd and > >/etc/master.passwd are trashed (I used chsh just before the crash). > >My user line is missing in passwd, and the master.passwd file is > >just binary garbage. pwd.db and spwd.db however seem to be ok. > >How can I recover the text files from the databases? > >pwd_mkdb(8) talks about creating a v7 style passwd file via the > >-p option but I don't know what to pass as file argument, if I > >do pwd_mkdb -p /etc/pwd.db I get: >=20 > Following up my own mail, I found at least one solution in the > meantime; there was a proper backup of master.passwd in /var/backups; > and on that file pwd_mkdb worked. The question remains, however, > what to do in the case when only the databases are left and all > textual files are trashed. Surely there must be a way to create > the text files from the db? >=20 > --=20 > Matthias Buelow >=20 > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message Launch the utility `vipw` and then immediately close it without editing anything. It will recreate the file /etc/passwd from master.passwd if it doesn't exist. Nathan --=20 GPG Public Key ID: 0x4250A04C gpg --keyserver pgp.mit.edu --recv-keys 4250A04C http://63.105.21.156/gpg_nkinkade_4250A04C.asc --aHoHdjwP6C+YV8GI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+YiHQWZYS9EJQoEwRAoxXAJwK3lP1Yj/2iDlQz6EfcFimkuC7cACfRTIW AYW40dEQSXf2oqY5kJuAxms= =v447 -----END PGP SIGNATURE----- --aHoHdjwP6C+YV8GI-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message