Merged with chkgrp and renamed to chkusr.

This commit is contained in:
Johannes Findeisen 2025-06-27 00:57:42 +02:00
commit 8644ccbdc5
12 changed files with 779 additions and 22 deletions

View file

@ -1,18 +1,30 @@
# chkpwd
# 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](https://en.wikipedia.org/wiki/Pluggable_Authentication_Module)-based system.
Currently chkpwd is only tested on Linux, but it should work on a [AIX](https://en.wikipedia.org/wiki/IBM_AIX), [DragonFly BSD](https://www.dragonflybsd.org/), [FreeBSD](https://www.freebsd.org/), [HP-UX](https://en.wikipedia.org/wiki/HP-UX), [Linux](https://kernel.org/), [macOS](https://en.wikipedia.org/wiki/MacOS), [NetBSD](https://netbsd.org/) and [Solaris](https://en.wikipedia.org/wiki/Oracle_Solaris) operating system too.
## The idea
### 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
### 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
### Building chkpwd
```
git clone https://git.xw3.org/hanez/chkpwd.git
@ -22,7 +34,7 @@ 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
#### Custom build example
Set MAX_UID and MIN_UID at compile time:
@ -30,7 +42,7 @@ 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
### Installation
**WARNING:** Install this software with care. chkpwd could easily be used for bruteforcing passwords from local users!
@ -42,13 +54,13 @@ chkpwd is installed to /usr/bin/.
chkpwd.h is installed to /usr/include/ for use in other applications.
## Uninstall
### Uninstall
```
sudo make uninstall
```
## Usage
### Usage
```
chkpwd -h
@ -68,44 +80,38 @@ You can also use chkpwd even without installing by just running the following co
./chkpwd
```
### Return codes
#### Return codes
chkpwd returns 0 on success, 1 otherwise.
### Examples
#### Examples
#### Interactive mode asking for a username and a password
##### Interactive mode asking for a username and a password
```
chkpwd
```
#### Interactive mode only asking for a password
##### Interactive mode only asking for a password
```
chkpwd -u hanez
```
#### None interactive mode with username and password provided as arguments to chkpwd
##### None interactive mode with username and password provided as arguments to chkpwd
```
chkpwd -u hanez -p password
```
#### Request the result from the above commands
##### Request the result from the above commands
```
echo $?
```
## License
chkpwd is licensed under the Apache License, Version 2.0.
See LICENSE for details.
## Links
#### Links
- [https://git.xw3.org/hanez/chkpwd](https://git.xw3.org/hanez/chkpwd)
- [https://www.man7.org/linux/man-pages/man8/unix_chkpwd.8.html](https://www.man7.org/linux/man-pages/man8/unix_chkpwd.8.html)
@ -115,3 +121,9 @@ See LICENSE for details.
- [https://github.com/ViKingIX/pam_test](https://github.com/ViKingIX/pam_test)
- [https://github.com/Dareka826/chk_pw](https://github.com/Dareka826/chk_pw)
## License
chkpwd is licensed under the Apache License, Version 2.0.
See LICENSE for details.