Subject: Re: query regarding getpwnam() function
To: Krishna Murthy <krishna.kn@ap.sony.com>
From: Klaus Klein <kleink@reziprozitaet.de>
List: netbsd-help
Date: 02/19/2004 11:54:47
On Thursday 19 February 2004 08:46, Krishna Murthy wrote:

> 1. Can you please specify why /etc/pw.db file is refered,  eventhough
> /etc/passwd file is present

Speed.  Looking up the user's name in a hashed db(3) database has
advantages over examining the corresponding text file line by line.

> 2. How to generate /etc/pw.db file

Have a look at pwd_mkdb(8) and pw_mkdb(3).  Note that actually
two databases (/etc/pwd.db and /etc/spwd.db) are generated from
/etc/master.passwd; so is /etc/passwd.


- Klaus