I am configuring LDAP client for user authentication on the server. Currently SSH key authentication is allowed and password authentication is not allowed.
My SSH configurtion (/etc/ssh/sshd_config)
PermitRootLogin no
AuthorizedKeysCommand /path/to/getsshkey.sh
AuthorizedKeysCommandUser root
PasswordAuthentication no
My other config files:
I have added following line in /etc/pam.d/common-auth
auth required pam_access.so
I have added the following line in /etc/pam.d/sshd
account required pam_access.so
I have added the following line in /etc/security/access.conf
-: ALL EXCEPT root (group1) (group2): ALL except LOCAL
I have also configured all these files (/etc/ldap.conf, /etc/nsswitch.conf, /etc/pam.d/common-session)
For an example username1 belong to group1
Executing this command:
ssh -i private.pem username1@ip_address
Returns the below error in auth.log on the server:
Access denied for user username1 by PAM account configuration [preauth]
Why is access denied?