Passwd

Parses /etc/passwd

Author: Free Ekanayaka fr.nosp@m.ee@64stud.nosp@m.io.com

Summary
PasswdParses /etc/passwd
Reference
USEFUL PRIMITIVES
Comments and empty lines
ENTRIES
passwordpw_passwd
uidpw_uid
gidpw_gid
namepw_gecos; the user’s full name
homepw_dir
shellpw_shell
entrystruct passwd

Reference

  • man 5 passwd
  • man 3 getpwnam

Each line in the unix passwd file represents a single user record, whose colon-separated attributes correspond to the members of the passwd struct

USEFUL PRIMITIVES

Comments and empty lines

ENTRIES

password

let password = [ label "password" . sto_to_col? . colon ]

pw_passwd

uid

let uid = [ label "uid" . store integer . colon ]

pw_uid

gid

let gid = [ label "gid" . store integer . colon ]

pw_gid

name

let name = [ label "name" . sto_to_col? . colon ]

pw_gecos; the user’s full name

home

let home = [ label "home" . sto_to_col? . colon ]

pw_dir

shell

let shell = [ label "shell" . sto_to_eol? ]

pw_shell

entry

let entry = [ key username . colon . password . uid . gid . name . home . shell . eol ]

struct passwd

let password = [ label "password" . sto_to_col? . colon ]
pw_passwd
let uid = [ label "uid" . store integer . colon ]
pw_uid
let gid = [ label "gid" . store integer . colon ]
pw_gid
let name = [ label "name" . sto_to_col? . colon ]
pw_gecos; the user’s full name
let home = [ label "home" . sto_to_col? . colon ]
pw_dir
let shell = [ label "shell" . sto_to_eol? ]
pw_shell
let entry = [ key username . colon . password . uid . gid . name . home . shell . eol ]
struct passwd
Close