Go to the previous, next section.

Looking Up One User

You can search the system user database for information about a specific user using getpwuid or getpwnam. These functions are declared in `pwd.h'.

Function: struct passwd * getpwuid (uid_t uid)

This function returns a pointer to a statically-allocated structure containing information about the user whose user ID is uid. This structure may be overwritten on subsequent calls to getpwuid.

A null pointer value indicates there is no user in the data base with user ID uid.

Function: struct passwd * getpwnam (const char *name)

This function returns a pointer to a statically-allocated structure containing information about the user whose user name is name. This structure may be overwritten on subsequent calls to getpwnam.

A null pointer value indicates there is no user named name.

Go to the previous, next section.