checkpw is a program that checks the validity of a users password on a UNIX/PAM-based system.
Currently checkpw is only tested on Linux, but it should work on a AIX, DragonFly BSD, FreeBSD, HP-UX, Linux, macOS, NetBSD and Solaris operating system too.
I needed a program to verify passwords of users on Linux/UNIX systems using PAM that just returns 0 on success and 1 on error.
git clone https://git.xw3.org/xw3/checkpw.git
cd checkpw
make
The code only supports verifying passwords for user id 1000 by default. Look at the file checkpw.h for some compile time options!
Set MAX_UID and MIN_UID at compile time:
gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o checkpw checkpw.c -lpam -lpam_misc
WARNING: Install this software with care. checkpw could easily be used for bruteforcing passwords from local users!
sudo make install
checkpw is installed to /usr/bin/.
checkpw.h is installed to /usr/include/ for use in other applications.
sudo make uninstall
checkpw -h
Usage: checkpw [-u <username>] [-p <password>] [-v] [-V] [-h]
Options:
-u <username> Set username.
-p <password> Set password.
-v Enable verbose mode.
-V Print program version.
-h Show this help.
You can also use checkpw even without installing by just running the following command:
./checkpk
checkpw returns 0 on success, 1 otherwise.
checkpw
checkpw -u hanez
checkpw -u hanez -p password
echo $?
checkpw is licensed under the Apache License, Version 2.0.
See LICENSE for details.