2024-08-28 02:05:27 +02:00
|
|
|
# checkpw
|
2024-08-10 06:03:34 +02:00
|
|
|
|
2024-08-10 07:20:56 +02:00
|
|
|
checkpw is a program that checks the validity of a users password on a Linux/PAM-based system.
|
2024-08-10 06:08:41 +02:00
|
|
|
|
2024-08-10 23:38:07 +02:00
|
|
|
## The idea behind:
|
|
|
|
|
|
2024-08-17 23:07:57 +02:00
|
|
|
I needed a program to verify passwords of users on Linux based systems using PAM.
|
|
|
|
|
|
2024-08-10 23:38:54 +02:00
|
|
|
Exactly a program like this... not more!
|
2024-08-10 23:38:07 +02:00
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
## Installation:
|
2024-08-10 23:38:07 +02:00
|
|
|
|
2024-08-17 23:07:57 +02:00
|
|
|
**WARNING:** Install this software with care. checkpw could easily be used for bruteforcing passwords from local users!
|
|
|
|
|
|
2024-08-10 23:38:07 +02:00
|
|
|
```
|
2024-08-28 02:24:15 +02:00
|
|
|
git clone https://git.xw3.org/xw3/checkpw.git
|
2024-08-10 23:38:07 +02:00
|
|
|
cd checkpw
|
|
|
|
|
make
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-17 23:07:57 +02:00
|
|
|
The code only supports verifying passwords for user id 1000 by default. Look a the code for some compile time options!
|
|
|
|
|
|
2024-08-28 18:16:59 +02:00
|
|
|
### Manual installation:
|
|
|
|
|
|
2024-08-17 23:07:57 +02:00
|
|
|
Set MAX_UID and MIN_UID in the code or you can compile checkpw without editing the code using the following command and install it manually:
|
|
|
|
|
|
|
|
|
|
```
|
2024-08-27 20:12:59 +02:00
|
|
|
gcc -Werror -DMAX_UID=1000 -DMIN_UID=1000 -o checkpw checkpw.c -lpam -lpam_misc
|
2024-08-17 23:07:57 +02:00
|
|
|
sudo cp ./checkpw /usr/bin/
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-27 20:27:17 +02:00
|
|
|
## Uninstall:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sudo make uninstall
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
## Usage:
|
2024-08-10 15:55:11 +02:00
|
|
|
|
|
|
|
|
```
|
2024-08-17 23:22:21 +02:00
|
|
|
checkpw -h
|
|
|
|
|
Usage: checkpw [-u <username>] [-p <password>] [-i] [-v] [-h]
|
2024-08-10 15:52:47 +02:00
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
-u <username> Specify username.
|
|
|
|
|
-p <password> Specify password.
|
|
|
|
|
-i Enable interactive mode to prompt for missing username/password.
|
|
|
|
|
-v Enable verbose mode.
|
2024-08-28 18:16:59 +02:00
|
|
|
-V Show program version.
|
2024-08-18 01:02:34 +02:00
|
|
|
-h Show this help.
|
2024-08-10 15:52:47 +02:00
|
|
|
```
|
|
|
|
|
|
2024-08-10 07:21:52 +02:00
|
|
|
Returns 0 on success, 1 otherwise.
|
|
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
### Examples:
|
2024-08-18 02:03:29 +02:00
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
#### Interactive mode:
|
2024-08-18 02:03:29 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
checkpw -i
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
#### Interactive mode only asking for a password:
|
2024-08-18 02:03:29 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
checkpw -u hanez -i
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-18 04:08:06 +02:00
|
|
|
#### None interactive mode with username and password provided as arguments to checkpw:
|
2024-08-18 02:03:29 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
checkpw -u hanez -p password
|
|
|
|
|
```
|
|
|
|
|
|
2024-08-18 02:05:38 +02:00
|
|
|
#### Request the result from the above commands:
|
2024-08-18 02:03:29 +02:00
|
|
|
|
2024-08-10 15:54:14 +02:00
|
|
|
```
|
|
|
|
|
echo $?
|
|
|
|
|
```
|
2024-08-10 22:12:47 +02:00
|
|
|
|
2024-08-20 17:52:42 +02:00
|
|
|
## Links:
|
|
|
|
|
|
|
|
|
|
- [https://cr.yp.to/checkpwd.html](https://cr.yp.to/checkpwd.html)
|
2024-08-27 21:04:25 +02:00
|
|
|
- [https://pamtester.sourceforge.net/](https://pamtester.sourceforge.net/)
|
2024-08-20 17:52:42 +02:00
|
|
|
|