I'm working on a program that would value from using the built in PAM module of linux, for authentication and verifying user entered credentials. I've been trying to research how it's implemented, however much documentation I find is old and usually deleted, and I have trouble finding many examples of it being used in a casual script.
Can someone help me understand how PAM would be used with a custom script, specifically to pass a username and password for authentication, and maybe point me to documentation on how to use it?
You could use sudo
to check the password.
printf "%s" "$password" | sudo -n -S -u "$username" true