Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the PAM module to execute a script which needs to know the username/password coming from the application (OpenVPN in this case).

I have a script that executes printenv >>afile, but I don't see all the environment variables that the man pages states that exports (namely PAM_USER I think), I only see the following:


I do successfully pick up the password off of STDIN and output it with this same script. But for the life of me I can't get the username.

Any thoughts on what I should try next?

share|improve this question

What distribution are you using? RHEL and CentOS use pam 0.99. There's currently a bug open for this issue ( but I believe they're just using an ancient version of PAM.

share|improve this answer

If you set key-value pairs with the plugin "" like this:

plugin /usr/lib/openvpn/ "openvpn mykey myval login COMMONNAME"

then it doesn't set PAM_USER (because it calls pam_start with user=NULL), maybe that's your problem?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.