This post is here to highlight that some LDAP attributes are cached locally (like sshPublicKey)
This command is named ldapgetusrattr.This command was released not so long ago (~1 year)
Example of script you can use in sshd_config to get the SSH public key of a user:
SSH_USER="${1}"
if [ -f /usr/sbin/ldapgetusrattr ]; then
/usr/sbin/ldapgetusrattr $SSH_USER sshPublicKey
else
lsldap -a passwd $SSH_USER | nawk -F': ' '/sshPublicKey:/ { print $2 }'
fi
Cheers
------------------------------
Lionel Widmer
------------------------------