Module posix.pwd

Password Database Operations.

Query the system password database.

Functions

endpwent () Release password database resources.
getpwent () Fetch next password entry.
getpwnam (name) Fetch named user.
getpwuid (uid) Fetch password entry with given user id.
setpwent () Rewind next getpwent back to start of database.

Tables

PosixPasswd Password record.


Functions

endpwent ()
Release password database resources.

See also:

getpwent ()
Fetch next password entry.

Returns:

    PosixPasswd next password record

See also:

Usage:

    local pwd = require "posix.pwd"
    t = pwd.getpwent ()
    while t ~= nil do
      process (t)
      t = pwd.getpwent ()
    end
    pwd.endpwent ()
getpwnam (name)
Fetch named user.

Parameters:

Returns:

    PosixPasswd passwd record for name, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Usage:

    local pwd = require "posix.pwd"
    t = pwd.getpwnam "root"
getpwuid (uid)
Fetch password entry with given user id.

Parameters:

  • uid int user id

Returns:

    PosixPasswd passwd record for uid, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Usage:

    local pwd = require "posix.pwd"
    t = pwd.getpwuid (0)
setpwent ()
Rewind next getpwent back to start of database.

See also:

Tables

PosixPasswd
Password record.

Fields:

  • pw_name string user's login name
  • pw_uid int unique user id
  • pw_gid int user's default group id
  • pw_dir string initial working directory
  • pw_shell string user's login shell path
generated by LDoc 1.5.0 Last updated 2023-06-16 20:19:12