Documentation ¶
Index ¶
- func ComparePasswordWithHashedPassword(candidatePassword string, hashedPassword string) (bool, error)
- func Crypt(clearPassword, setting string) (string, error)
- func GetEGid() int32
- func GetEUid() int32
- func GetGid() int32
- func GetUid() int32
- func NewUnixSocketPath() (string, error)
- func PasswordAuthAvailable() bool
- func StartWithAttrsAndPty(c *exec.Cmd, sz *ptylib.Winsize, attrs *syscall.SysProcAttr, pty *os.File, ...) error
- func StartWithSizeAndPty(cmd *exec.Cmd, ws *ptylib.Winsize, pty *os.File, tty *os.File) error
- func UserPasswordAuthentication(username, password string) (bool, error)
- type ShadowEntry
- type User
- func (u *User) CreateCommand(addEnv string, stdout, stderr io.Writer, stdin io.Reader, loginShell bool, ...) (*exec.Cmd, io.Reader, io.Reader, io.Writer, error)
- func (u *User) CreateCommandPipeOutput(addEnv string, loginShell bool, command string, args ...string) (*exec.Cmd, io.Reader, io.Reader, io.Writer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePasswordWithHashedPassword ¶
func ComparePasswordWithHashedPassword(candidatePassword string, hashedPassword string) (bool, error)
* Compares the provided password with the one stored in the shadow passwords table (generally /etc/shadow)
func Crypt ¶
* Wrapper around libc's crypt function * Similarly to the original function, the setting string * can also be a fully hashed password, crypt() will only * look at the three first components.
func NewUnixSocketPath ¶
func PasswordAuthAvailable ¶
func PasswordAuthAvailable() bool
func StartWithAttrsAndPty ¶
func StartWithAttrsAndPty(c *exec.Cmd, sz *ptylib.Winsize, attrs *syscall.SysProcAttr, pty *os.File, tty *os.File) error
copied and adapted from github.com/creack/pty StartWithAttrs assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, and c.Stderr, calls c.Start, and returns the File of the tty's corresponding pty.
This will resize the pty to the specified size before starting the command if a size is provided. The `attrs` parameter overrides the one set in c.SysProcAttr.
This should generally not be needed. Used in some edge cases where it is needed to create a pty without a controlling terminal.
func StartWithSizeAndPty ¶
adapted from github.com/creack/pty StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, and c.Stderr, calls c.Start, and returns the File of the tty's corresponding pty.
This will resize the pty to the specified size before starting the command. Starts the process in a new session and sets the controlling terminal.
func UserPasswordAuthentication ¶
* Returns a boolean stating whether the user is correctly authenticated on this * server. May return a UserNotFound error when the user does not exist.
Types ¶
type ShadowEntry ¶
func Getspnam ¶
func Getspnam(name string) (*ShadowEntry, error)
* Wrapper around libshadow's getspnam function * copied from https://stackoverflow.com/questions/38790092/call-a-c-function-from-go