36.9 Password Database Functions

Octave’s password database functions return information in a structure with the following fields.

name

The user name.

passwd

The encrypted password, if available.

uid

The numeric user id.

gid

The numeric group id.

gecos

The GECOS field.

dir

The home directory.

shell

The initial shell.

In the descriptions of the following functions, this data structure is referred to as a pw_struct.

: pw_struct = getpwent ()

Return a structure containing an entry from the password database, opening it if necessary.

Once the end of the data has been reached, getpwent returns 0.

See also: setpwent, endpwent.

: pw_struct = getpwuid (uid).

Return a structure containing the first entry from the password database with the user ID uid.

If the user ID does not exist in the database, getpwuid returns 0.

See also: getpwnam.

: pw_struct = getpwnam (name)

Return a structure containing the first entry from the password database with the user name name.

If the user name does not exist in the database, getpwname returns 0.

See also: getpwuid.

: setpwent ()

Return the internal pointer to the beginning of the password database.

See also: getpwent, endpwent.

: endpwent ()

Close the password database.

See also: getpwent, setpwent.

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Password-Database-Functions.html