From owner-freebsd-questions Mon Sep 7 15:55:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA22033 for freebsd-questions-outgoing; Mon, 7 Sep 1998 15:55:13 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from kstreet.interlog.com (kstreet.interlog.com [198.53.146.171]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA22028 for ; Mon, 7 Sep 1998 15:55:11 -0700 (PDT) (envelope-from kws@kstreet.interlog.com) Received: (from kws@localhost) by kstreet.interlog.com (8.9.1/8.8.8) id SAA27735; Mon, 7 Sep 1998 18:54:49 -0400 (EDT) (envelope-from kws) To: Dr R D Gidden Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Invalid master.passwd file References: <87hfyj4nnd.fsf@kstreet.interlog.com> From: Kevin Street Date: 07 Sep 1998 18:54:49 -0400 In-Reply-To: Kevin Street's message of "07 Sep 1998 17:29:42 -0400" Message-ID: <87af4b3552.fsf@kstreet.interlog.com> Lines: 42 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Kevin Street writes: > Dr R D Gidden writes: > snip > > > I have over 700 users in this file (AARGH!): is it possible > > to work back from the .db file(s)? My backup was just > > *before* a whole slew of new users were added :-(( > > Bob, I don't know about working backwards from the .db files, but have > you checked in /var/backups to see if there's a good version there? Oh, and come to think of it, it is easy to get the info from the .db files too if you have really wiped out master.passwd & all backups. If you run this as root it should print out a copy of the master.passwd file that it reads from spwd.db. (If you run it as a normal user you get "*" for all the passwords.) #include #include int main(int argc, char **argv) { struct passwd * pw; pw = getpwent(); while (0 != pw) { printf("%s:%s:%d:%d:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class, pw->pw_change, pw->pw_expire, pw->pw_gecos, pw->pw_dir, pw->pw_shell); pw = getpwent(); } endpwent(); return 0; } -- Kevin Street street@iName.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message