How to use pam_exec.so to allow or deny access of an user base on exit code of a script

Solution Verified - Updated -

Issue

I want to use the pam_exec.so shared library to allow or deny a user, based on the exit code of a script:

account    required     pam_exec.so debug log=/var/log/pam_debug.log some-shell-or-python-script.sh/.py

Environment

  • Red Hat Enterprise Linux 8.9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content