I have imported from what I can tell successfully the sshPublicKey schema but the attribute doesn't show in PHPLDAPADMIN.

Anybody have any experience with this issue?

What I did verbatim :

sudo nano openssh-lpk.ldif

dn: cn=openssh-lpk,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: openssh-lpk
olcAttributeTypes: ( NAME 'sshPublicKey'
  DESC 'MANDATORY: OpenSSH Public key'
  EQUALITY octetStringMatch
olcObjectClasses: ( NAME 'ldapPublicKey' SUP top AUXILIARY
  DESC 'MANDATORY: OpenSSH LPK objectclass'
  MAY ( sshPublicKey $ uid )

Import the schema, should I change ldapi://? I tried using my IP/Loopback and it doesn't work, but it seems to work as is.

ldapadd -Y EXTERNAL -H ldapi:/// -f openssh-lpk.ldif

Got this from this guide here >> https://blog.shichao.io/2015/04/17/setup_openldap_server_with_openssh_lpk_on_ubuntu.html

Confirmed its what I'm supposed to via this post on SF.

SSH key authentication using LDAP

But his instructions are a bit vague...

"Update LDAP to include the OpenSSH-LPK schema"

We first need to update LDAP with a schema to add the sshPublicKey attribute for users:

How? What am I doing wrong?


PS: This is the output of me running the command, all seems well, it even says "Duplicate"

root@ldap:~# ldapadd -Y EXTERNAL -H ldapi:/// -f openssh-lpk.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
adding new entry "cn=openssh-lpk,cn=schema,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
        additional info: olcAttributeTypes: Duplicate attributeType: ""

UPDATE: I can see the schema in PHPLDAPADMIN, but its not under the PosiX Account, can somebody post the attribute tag from /etc/phpldapadmin/templates/creation/posixAccount.xml

enter image description here


Since this was really a GUI Issue, (another example of why its best to learn things on the CLI), my answer will be a Picture. But long story short is I was reading the directions to fast!

"Adding a user with SSH public key in phpLDAPadmin

First, create a user with the “Generic: User Account” template. Then, go to the “objectClass” attribute section, click “add value”, and choose the “ldapPublicKey” attribute. After you submit, go back to the user edit page, click “Add new attribute” on the top part, and choose “sshPublicKey”, paste the public key into the text area, and finally click “Update Object”."

enter image description here

| improve this answer | |

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.