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 ¶ added in v0.7.0
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 ShadowEntry ¶ added in v1.2.25
type ShadowEntry struct {
UserName string
Password string
LastChg string
Min string
Max string
Warn string
Inact string
Expire string
Flag string
}
func (*ShadowEntry) Parse ¶ added in v1.2.25
func (se *ShadowEntry) Parse(line string) error
Parse parses an /etc/shadow line into a ShadowEntry
type ShadowFile ¶ added in v1.2.25
type ShadowFile struct {
Entries []ShadowEntry
// contains filtered or unexported fields
}
func ReadOrCreateShadowFile ¶ added in v1.2.25
func ReadOrCreateShadowFile(fsys apkfs.FullFS, filepath string) (ShadowFile, error)
ReadOrCreateShadowFile parses an /etc/shadow file into a ShadowFile. An empty file is created if /etc/shadow is missing.
func ReadShadowFile ¶ added in v1.2.25
func ReadShadowFile(fsys fs.FS, filepath string) (ShadowFile, error)
Read ShadowFile parses an /etc/shadow file into a ShadowFile. If /etc/shadow is missing, returns an error
func (*ShadowFile) Write ¶ added in v1.2.25
func (sf *ShadowFile) Write(w io.Writer) error
Write writes an /etc/shadow file into an io.writer
func (*ShadowFile) WriteFile ¶ added in v1.2.25
func (sf *ShadowFile) WriteFile(filepath string) error
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 ¶ added in v0.7.0
ReadUserFile parses an /etc/passwd file into a UserFile. If it is missing, returns an error.