Skip to content

pwdb #

Access to the UNIX Password Database

pwdb module provides thread-safe access to the UNIX user account and password database.

See passwd(5), getpwent(3) and getpwnam(3) for info.

fn get_all #

fn get_all() []Passwd

get_all returns all entries from passwd database in arbitrary order.

fn get_by_name #

fn get_by_name(name string) !Passwd

get_by_uid returns the passwd database entry by user name. If the entry is not found, the EntryNotFoundError error will be returned.

fn get_by_uid #

fn get_by_uid(uid int) !Passwd

get_by_uid returns the passwd database entry by user ID. If the entry is not found, the EntryNotFoundError error will be returned.

struct EntryNotFoundError #

struct EntryNotFoundError {
	Error
	name string
	uid  int
}

EntryNotFoundError designates that an entry with the specified UID or name was not found.

fn (EntryNotFoundError) msg #

fn (e EntryNotFoundError) msg() string

msg returns the EntryNotFoundError error message.

struct Passwd #

struct Passwd {
pub:
	name   string // username
	passwd string // user password, usually set to 'x'
	uid    int    // user ID
	gid    int    // group ID
	gecos  string // user information
	dir    string // home directory
	shell  string // shell program
}