userutils

package
v0.0.0-...-b593ba2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootUser          = "root"
	RootHomeDir       = "/root"
	UserHomeDirPrefix = "/home"

	ShadowFile = "/etc/shadow"
)

Variables

This section is empty.

Functions

func AddUser

func AddUser(username string, hashedPassword string, uid string, installChroot safechroot.ChrootInterface) error

func HashPassword

func HashPassword(password string) (string, error)

func NameIsValid

func NameIsValid(name string) (err error)

NameIsValid returns an error if the User name is empty

func PasswordExpiresDaysIsValid

func PasswordExpiresDaysIsValid(passwordExpiresDays int64) error

PasswordExpiresDaysISValid returns an error if the expire days is not within bounds set by the chage -M command

func UIDIsValid

func UIDIsValid(uid int) error

UIDIsValid returns an error if the UID is outside bounds UIDs 1-999 are system users and 1000-60000 are normal users Bounds can be checked using: $grep -E '^UID_MIN|^UID_MAX' /etc/login.defs

func UpdateUserPassword

func UpdateUserPassword(installRoot, username, hashedPassword string) error

func UserExists

func UserExists(username string, installChroot safechroot.ChrootInterface) (bool, error)

func UserHomeDirectory

func UserHomeDirectory(username string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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