Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Rich Alderson <alderson+news@panix.com>
Subject: Re: corrupt /etc/passwd
Date: 24 Jul 2002 13:01:23 -0400	[thread overview]
Message-ID: <mddy9c1ukkc.fsf@panix1.panix.com> (raw)
In-Reply-To: ahlfdb$vcr$1@Mercury.ev.co.yu

"Nikola Milutinovic" <Nikola.Milutinovic@ev.co.yu> writes:

> /etc/passwd.dir and /etc/passwd.pag are DBM files generated from /etc/passwd
> by command "mkpasswd". As long as they are intact, you'll be able to login,
> but nothing else. Restoring? Well, I suppose it can be restored, but I've
> never seen a utility for that. Theoretically, you could write a small C
> program to just open DBM version and read all keyes and write them to STDOUT.

Perl has builtin support for treating DBM files as hash tables.  The following
Perl script should suffice to provide the information in the DBM version of
/etc/passwd:

	#!/usr/bin/perl -w

	use strict;

	dbmopen(%PASSWD, "/etc/passwd", undef)
		or die "Cannot open password database";

	while (my ($key, $value) = each (%DATA)) {
		print "$key:$value\n";
	}

Hope that helps.

-- 
Rich Alderson                                          alderson+news@panix.com
  "You get what anybody gets.  You get a lifetime."  --Death, of the Endless


  parent reply	other threads:[~2002-07-24 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23 12:57 corrupt /etc/passwd Skaghk
2002-07-23 14:11 ` Sylvain Robitaille
2002-07-24  5:32 ` Nikola Milutinovic
2002-07-24 10:04   ` Craig Markwardt
2002-07-24 12:05     ` Stuart Fuller
2002-07-24 12:24     ` Skaghk
2002-07-30 14:19       ` Michael Joosten
2002-07-31 18:42         ` Sylvain Robitaille
2002-08-05 14:42           ` Michael Joosten
2002-07-24 17:01   ` Rich Alderson [this message]
2002-07-24 18:53 ` Paul A Sand
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox