It's hard to say what the correct way is. getpwnam returns the
password structure (and that's different things on different *Nixes but
basically user name, user id, group id, encrypted password, real name,
home directory, and shell). Exactly what do you need for your script?