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

 
 
 

Contributors

Languages