Documentation ¶
Overview ¶
Package passwd implements simple functions to parse and manipulate /etc/passwd and /etc/group files
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupEntry ¶
GroupEntry describes a single line in /etc/group.
func (*GroupEntry) Parse ¶
func (ge *GroupEntry) Parse(line string) error
Parse parses an /etc/group line into a GroupEntry.
type GroupFile ¶
type GroupFile struct {
Entries []GroupEntry
}
GroupFile describes an entire /etc/group file's contents.
func ReadGroupFile ¶
ReadGroupFile parses an /etc/group file into a GroupFile. If /etc/group is missing, returns an error
func ReadOrCreateGroupFile ¶
ReadOrCreateGroupFile parses an /etc/group file into a GroupFile. An empty file is created if /etc/group is missing.
type UserEntry ¶
type UserEntry struct { UserName string Password string UID uint32 GID uint32 Info string HomeDir string Shell string }
UserEntry contains the parsed data from an /etc/passwd entry.
type UserFile ¶
type UserFile struct { Entries []UserEntry // contains filtered or unexported fields }
UserFile contains the entries from an /etc/passwd file.
func ReadOrCreateUserFile ¶
ReadOrCreateUserFile parses an /etc/passwd file into a UserFile. An empty file is created if /etc/passwd is missing.
func ReadUserFile ¶
ReadUserFile parses an /etc/passwd file into a UserFile. If it is missing, returns an error.