Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default file path for shadow file. DefaultShadowFilename = "/etc/shadow" // Default file path for passwd file. DefaultPasswdFilename = "/etc/passwd" )
View Source
var ErrUserNotFound = errors.New("user not found")
ErrUserNotFound is returned when the user is not found in the passwd file.
Functions ¶
func AuthUser ¶
AuthUser attempts to authenticate username and password from DefaultPasswdFilename.
func AuthUserFromShadow ¶ added in v0.15.1
AuthUserFromShadow attempts to authenticate username and password from file.
func VerifyPasswordHash ¶
VerifyPasswordHash checks if the password match with the hash.
Types ¶
type Backend ¶ added in v0.15.1
type Backend interface {
AuthUser(username, password string) bool
LookupUser(username string) (*User, error)
}
var DefaultBackend Backend
type User ¶
type User struct {
UID uint32 // The user ID of the account.
GID uint32 // The group ID of the account.
Username string // The login name of the account.
Password string // The hashed password of the account.
Name string // The full name of the account owner.
HomeDir string // The home directory path of the account.
Shell string // The default login shell for the account.
}
func LookupUser ¶
LookupUser try to find a [PasswordEntry] for a username from a DefaultPasswdFilename.
Click to show internal directories.
Click to hide internal directories.