Skip to content

yoonka/pam_auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pam_auth

A simple cross-platform CLI tool written in Rust that authenticates users against the system PAM (Pluggable Authentication Modules) stack.


πŸ” What It Does

pam_auth is a small binary that takes a username and password as command-line arguments and checks them using PAM β€” just like how login, sudo, or sshd authenticate users.

βœ… Works with system accounts
βœ… Supports any PAM backend (e.g. LDAP, shadow, 2FA)
βœ… Does not require root privileges to run


πŸ“¦ Usage

pam_auth <username> <password>

Example:

pam_auth edwin secret123

Returns:

  • Exit code 0: βœ… Authentication successful
  • Exit code 2: ❌ Authentication failed

πŸ”§ Building Locally

Prerequisites

  • Rust
  • libpam development headers (Linux/FreeBSD)
cargo build --release
./target/release/pam_auth username password

πŸš€ Cross-Platform Builds

We use cross to compile for other OS targets:

cross build --release --target x86_64-unknown-linux-gnu
cross build --release --target x86_64-unknown-freebsd

Outputs:

target/x86_64-unknown-linux-gnu/release/pam_auth
target/x86_64-unknown-freebsd/release/pam_auth

πŸ§ͺ Testing

To test the binary:

./pam_auth root wrongpass    # Should fail
./pam_auth root correctpass  # Should succeed (if root password is known)

Note: For security, run only in secure, trusted environments.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages