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

I would like to use nginx PAM module to authenticate a site with existing users on a FreeBSD system. I tried to use, but no luck. It's just not let me in with my usr/psw pair. :(

nginx conf:

location / {
        root html;
        auth_pam               "Secure Zone";
        auth_pam_service_name  "nginx";
        fastcgi_pass ;
        fastcgi_index          index.php;
        fastcgi_param          SCRIPT_FILENAME  /var/www/$fastcgi_script_name;
        include                fastcgi_params;

The nginx file in the /usr/local/etc/pam.d dir:

auth    required
account required

I would appreciate if someone could tell me a working configuration. :)

share|improve this question
Can you also add some logs of what's going on from nginx perspective? Depending on your OS you can also find some clues in /var/log/auth.log or similar file. – kworr Aug 7 '13 at 8:12

1 Answer 1

Not sure if you've already tried this, but I did notice here:

Note that the module runs as the web server user, so the PAM modules used must be able to authenticate the users without being root; that means that if you want to use the module to autenticate users you need to let the web server user to read the /etc/shadow file if that does not scare you (on Debian like systems you can add the www-data user to the shadow group).

Nginx HTTP Auth PAM Module README

I can't confirm your config I'm afraid as I'm not using

share|improve this answer
I tried to add www group read permission to the /etc/master.passwd (the FreeBSD equivalent of /etc/shadow as far as i know.) But still i can't be authenticated with my user :( (the nginx processes are run by root default) – Noirello Mar 28 '12 at 10:06

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.