in reply to Re: Quick User Existance Check?
in thread Quick User Existance Check?

This will work if the system is guaranteed to use /etc/passwd, or if it's your system and it does use /etc/passwd, but it's not portable. It won't work if the system uses NIS, LDAP, a database-backed PAM module, etc. A more portable way of doing the same thing is getpwent.

And with either of these techniques, which is faster is determined by the speed of the backend, the number of users, and how many you're looking up. For example, it's probably not worth reading a 50,000-user remote NIS database to find 50 users, but it may be worth reading a 50,000-user /etc/passwd for 50 users.

As usual, the best overall answer is try a few things and benchmark.