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've specified an AD security group in PAM to restrict which domain users can login. I've also restricted sessions for AD users to this group. This prevents a logged in user from doing an "su -" to an AD user outside of the group.

The Winbind uid mapping is configured so that AD users have UID >= 10000000.

These work as expected with the PAM configuration below.


auth        required
auth        sufficient nullok try_first_pass
auth        requisite user ingroup AD_group debug
auth        requisite uid >= 500 quiet
auth        sufficient use_first_pass
auth        sufficient use_first_pass
auth        required

account     required
account     required broken_shadow
account     sufficient
account     sufficient uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore]
account     [default=bad success=ok user_unknown=ignore]
account     required

password    requisite try_first_pass retry=3
password    sufficient md5 shadow nullok try_first_pass use_authtok
password    sufficient use_authtok
password    sufficient use_authtok
password    required

session     [default=1 success=ignore] quiet uid >= 10000000
session     requisite user ingroup AD_group debug
session     optional umask=0077 skel=/etc/skel
session     optional revoke
session     required
session     optional
session     [success=1 default=ignore] service in crond quiet use_uid
session     required
session     optional

Now, I'd like to add a rule so that a specific AD user outside of AD_group can login. I tried adding the following line after line 3 in the file:

auth        requisite user=AD_user_1 debug

But this resulted in all AD users being allowed to login.

Any insight would be appreciated.

share|improve this question
If that test succeeds, you'd want to skip the group membership test, so another [success=1 default=ignore] would probably be more appropriate than requisite. I'm still interested in seeing this question answered though. – Andrew B Mar 1 '13 at 4:56
up vote 1 down vote accepted

All users succeeding in authentication is interesting, since that implies that the group membership test is now being ignored as well. (per my comment above, it doesn't look like you're skipping it) That sounds more like sufficient than requisite to me.

Have you double checked to make sure that you aren't testing against users who would pass the sufficient condition? Check your shadow table and make sure that someone didn't add local passwords for users in your test pool when you weren't looking.

It's also possible that the auth module is being skipped (SSH key authentication comes to mind), in which case your access checks being in auth instead of account will pose a problem. Whether or not this is the cause, I recommend moving them to account so that you won't have holes in your access policy.

auth = anything related to authentication

account = anything related to authorization (access checks)

share|improve this answer
Thanks for pointing me in the right direction. I moved the auth lines to account and also noticed that requires a space between user = AD_user_1 – kernelpanic Mar 15 '13 at 5:13

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.