Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
pam
✓ github.com/msteinert/pam
Authenticates a user via PAM.
package main
import (
"fmt"
"github.com/msteinert/pam"
)
func main() {
t, err := pam.StartFunc("", "username", func(s pam.Style, msg string) (string, error) {
switch s {
case pam.PromptEchoOff:
return "password", nil
case pam.PromptEchoOn:
return "response", nil
case pam.ErrorMsg:
fmt.Println(msg)
return "", nil
case pam.TextInfo:
fmt.Println(msg)
return "", nil
}
return "", fmt.Errorf("unexpected style: %v", s)
})
if err != nil {
panic(err)
}
if err := t.Authenticate(0); err != nil {
panic(err)
}
fmt.Println("Authenticated")
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.2.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.