shadow

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package shadow provides functions to read, modify and write a linux shadow file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File represents a Linux shadow file.

func FileFromReader

func FileFromReader(reader io.Reader) (*File, error)

FileFromReader loads a shadow file from the specified reader.

func NewFile

func NewFile() *File

NewFile returns a new shadow file.

func (*File) AddUser

func (file *File) AddUser(username string, password string) error

AddUser adds a new user to the shadow file.

func (*File) Dupe

func (file *File) Dupe() *File

Dupe returns a copy of the shadow file.

func (*File) SetPassword

func (file *File) SetPassword(username string, password string) error

SetPassword sets the password of the specified user.

func (*File) String

func (file *File) String() string

String returns the entire shadow file as a string.

func (*File) ToWriter

func (file *File) ToWriter(writer io.Writer) error

ToWriter writes the shadow file using the specified writer.

func (*File) VerifyPassword

func (file *File) VerifyPassword(username string, password string) (bool, error)

VerifyPassword verifys the password of the specified user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL