Some content update and fixes...

This commit is contained in:
Johannes Findeisen 2025-09-08 03:05:56 +02:00
commit f9e1cf4c05

View file

@ -6,6 +6,7 @@ chkusr is a set of programs to verify information about a user on UNIX based sys
* [The idea](#the-idea)
* [Requirements](#requirements)
* [Configuration](#configuration)
* [Building chkusr](#building-chkusr)
* [Installation](#installation)
* [Uninstall](#uninstall)
@ -25,13 +26,15 @@ chkusr is a set of programs to verify information about a user on UNIX based sys
## The idea
I needed some programs to verify some information about users and groups on a Linux/UNIX system just returning 0 on success and 1 on error.
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.
I needed some programs to verify some information about users and groups on a Linux/UNIX system just returning 0 on success and 1 on error. Some programs also return a message.
### Requirements
You need the PAM development package installed. On Alpine it is named linux-pam-dev, on Debian based systems it is libpam0g-dev.
You need the PAM development package installed. On Alpine it is named linux-pam-dev, on Debian based systems it is named libpam0g-dev.
### Configuration
chkusr needs to be configured before compilation. Always look at config.h for configuration options. I did it this way because I need the programs as small and simple as possible, and I don't want to parse a configuration file.
### Building chkusr
@ -59,19 +62,23 @@ chkpwd.h is installed to /usr/include/ for use in other applications.
sudo make uninstall
```
## chkgrp
## Programs
### chkgrp
chkgrp is a program to verify if a user is a member of a group.
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
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 code only supports verifying passwords for user id 1000 by default. Look at the file chkpwd.h for some compile time options!
### Usage
#### Usage
```
chkpwd -h
@ -91,37 +98,37 @@ You can also use chkpwd even without installing by just running the following co
./chkpwd
```
#### Return codes
##### Return codes
chk 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 $?
```
#### Custom build
##### Custom build
Set MAX_UID and MIN_UID at compile time:
@ -129,7 +136,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
```
## chkpwr
### chkpwr
A program to validate a string with a password rule. More to come...