chkusr is a set of programs to verify information about a user on PAM/UNIX based systems.
  • C 77.7%
  • Lua 14.3%
  • Makefile 5.3%
  • Roff 2.7%
Find a file
2025-06-27 00:57:42 +02:00
lua Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
.gitignore Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp-min.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp-native-min-extended.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp-native-min.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp-native.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp-ng.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkgrp.c Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
chkpwd.1 Just some small fixes and cosmetics... (1.3.1) 2025-06-05 20:23:53 +02:00
chkpwd.c Just some small fixes and cosmetics... (1.3.1) 2025-06-05 20:23:53 +02:00
chkpwd.h Just some small fixes and cosmetics... (1.3.1) 2025-06-05 20:23:53 +02:00
LICENSE Removed interactive mode (is default now), moved some code to checkpw.h and many fixes. 2025-01-01 06:23:03 +01:00
Makefile Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00
README.md Merged with chkgrp and renamed to chkusr. 2025-06-27 00:57:42 +02:00

MERGED PROJECT!!! I WILL UPDATE THIS README IN THE NEXT DAYS!!! THE FOLLOWING DOCUMENTATION WILL NOT WORK ACTUALLY!

chkusr

chkusr is a set of programs to verify information about a user on a UNIX based systems.

chkgrp

chkgrp is a set of programs to verify if a user is a member of a group on a UNIX based system. This code is so simple that it describes itself very good.

More information will follow... Actually there are multiple programs with some different behavior. I will write more about this, but for now I will not.

chkpwd

chkpwd is a program that checks the validity of a users password on a UNIX/PAM-based system.

Currently chkpwd 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.

The idea

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.

Requirements

You need the PAM development package installed. On Alpine it is named linux-pam-dev, on Debian based systems it is libpam0g-dev.

Building chkpwd

git clone https://git.xw3.org/hanez/chkpwd.git
cd chkpwd
make

The code only supports verifying passwords for user id 1000 by default. Look at the file chkpwd.h for some compile time options!

Custom build example

Set MAX_UID and MIN_UID at compile time:

gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o chkpwd chkpwd.c -lpam -lpam_misc

Installation

WARNING: Install this software with care. chkpwd could easily be used for bruteforcing passwords from local users!

sudo make install

chkpwd is installed to /usr/bin/.

chkpwd.h is installed to /usr/include/ for use in other applications.

Uninstall

sudo make uninstall

Usage

chkpwd -h
Usage: chkpwd [-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 chkpwd even without installing by just running the following command:

./chkpwd

Return codes

chkpwd returns 0 on success, 1 otherwise.

Examples

Interactive mode asking for a username and a password
chkpwd
Interactive mode only asking for a password
chkpwd -u hanez
None interactive mode with username and password provided as arguments to chkpwd
chkpwd -u hanez -p password
Request the result from the above commands
echo $?

License

chkpwd is licensed under the Apache License, Version 2.0.

See LICENSE for details.