We have an ldap server and an ldap client in a domain. As part of the in-charge of a subdomain, I want to enable ldap logins for only some users on a particular machine, and want to disable the rest of the users. I DO NOT have adminisptrative access to the ldap server. Can it be done. If so, how?

e.g. machine1, all users enabled for ldap login machine2, only xyz, and pqr are allowed to login machine3, abc and def are not allowed, rest all are allowed.

In short, to allow/disallow a subset of users from accessing a particular ldap-client, without root/administrative privileges to the ldap server.

nsswitch.conf looks like this:

passwd:     files ldap
shadow:     files ldap
group:      files ldap

Client runs Ubuntu 10.04 and OpenLDAP.

Thanks. EDIT: Please note that although I'm proficient in linux, I'm very new to LDAP(don't even understand the terminology well), and hence an easy, simple and adhoc solution would be more welcome than an advanced solution.


You list information about the directory configuration but what you want is authorization configuration, i.e., PAM. You can accomplish what you want to do by using pam_listfile where you would list all the users that are allowed to log in in a file and add pam_listfile to the pam stack.


Simple and adhoc, and having root access to the client machines: enable pam_access in the pam config and set up /etc/security/access.conf . See the samples in the file and pam_access(8).


Like others have said, check access.conf for many other examples.

This is how we do it in our shop.

  1. Modify /etc/pam.d/sshd

    #account required   pam_nologin.so
    account  required   pam_access.so
  2. Modify /etc/security/access.conf

    # root will get access from all sources
    + : root : ALL
    # Disallow all except these two groups and this user
    - : ALL EXCEPT group1 group2 userxyz : ALL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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