From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,e4ce2f02460124d3 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-07-24 10:01:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Rich Alderson Newsgroups: comp.unix.tru64 Subject: Re: corrupt /etc/passwd Date: 24 Jul 2002 13:01:23 -0400 Organization: Systems Administration, XKL LLC, Redmond WA 98052 Sender: alderson+news@panix1.panix.com Message-ID: References: <3d3d52b5$1@eumel.hag.hilti.com> NNTP-Posting-Host: panix1.panix.com X-Trace: reader3.panix.com 1027530083 26064 166.84.1.1 (24 Jul 2002 17:01:23 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 24 Jul 2002 17:01:23 +0000 (UTC) X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.unix.tru64:8212 "Nikola Milutinovic" 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