Operações
  1. Para adicionar um usuário: Criar um arquivo com o seguinte conteúdo:
    #begin
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    objectClass: top
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    objectClass: posixAccount
    objectClass: shadowAccount
    cn: joaquim.manoel
    givenName: joaquim.manoel
    uid: joaquim.manoel
    uidNumber: 1025
    homeDirectory: /home/joaquim.manoel
    loginShell: /bin/bash
    gecos: System User
    shadowLastChange: 14673
    shadowMax: 45
    gidNumber: 513
    telephoneNumber: 123-4567
    telephoneNumber: 765-4321
    sn: joaquim.manoel
    #end
    
    Executar o Comando:
    ldapadd -D "cn=manager,dc=example,dc=com" -v -W -f add.ldif 
    
    Resultado:
    ldap_initialize(  )
    Enter LDAP Password: 
    add objectClass:
       top
       person
       organizationalPerson
       inetOrgPerson
       posixAccount
       shadowAccount
    add cn:
       joaquim.manoel
    add givenName:
       joaquim.manoel
    add uid:
       joaquim.manoel
    add uidNumber:
       1025
    add homeDirectory:
       /home/joaquim.manoel
    add loginShell:
       /bin/bash
    add gecos:
       System User
    add shadowLastChange:
       14673
    add shadowMax:
       45
    add gidNumber:
       513
    add telephoneNumber:
       123-4567
       765-4321
    add sn:
       joaquim.manoel
    adding new entry "uid=joaquim.manoel,ou=People,dc=example,dc=com"
    modify complete
    
  2. Para mostrar os dados de um usuário:
    ldapsearch -D "cn=manager,dc=example,dc=com" -b "dc=example,dc=com" -W "(uid=joaquim.manoel)"
    
    Resultado:
    Enter LDAP Password: 
    # extended LDIF
    #
    # LDAPv3
    # base  with scope subtree
    # filter: (uid=joaquim.manoel)
    # requesting: ALL
    #
    
    # joaquim.manoel, People, example.com
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    objectClass: top
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    objectClass: posixAccount
    objectClass: shadowAccount
    cn: joaquim.manoel
    sn: joaquim.manoel
    givenName: joaquim.manoel
    uid: joaquim.manoel
    uidNumber: 1025
    homeDirectory: /home/joaquim.manoel
    loginShell: /bin/bash
    gecos: System User
    shadowLastChange: 14673
    shadowMax: 45
    gidNumber: 513
    
    # search result
    search: 2
    result: 0 Success
    
  3. Para alterar os dados de um usuário: Criar um arquivo com o seguinte conteúdo:
    #begin
    
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    changetype: modify
    replace: sn
    sn: joaquim manoel
    
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    changetype: modify
    add: telephoneNumber
    telephoneNumber: 123-4567
    telephoneNumber: 765-4321
    
    #end
    
    Exercutar o Comando:
    ldapmodify -D "cn=manager,dc=example,dc=com" -v -W -f change.ldif 
    
    Resultado:
    ldap_initialize(  )
    Enter LDAP Password: 
    replace sn:
       joaquim manoel
    modifying entry "uid=joaquim.manoel,ou=People,dc=example,dc=com"
    modify complete
    
    add telephoneNumber:
       123-4567
       765-4321
    modifying entry "uid=joaquim.manoel,ou=People,dc=example,dc=com"
    modify complete
    
    Executar o Comando:
    ldapsearch -D "cn=manager,dc=example,dc=com" -b "dc=example,dc=com" -W "(uid=joaquim.manoel)"
    
    Resultado:
    Enter LDAP Password: 
    # extended LDIF
    #
    # LDAPv3
    # base  with scope subtree
    # filter: (uid=joaquim.manoel)
    # requesting: ALL
    #
    
    # joaquim.manoel, People, example.com
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    objectClass: top
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    objectClass: posixAccount
    objectClass: shadowAccount
    cn: joaquim.manoel
    givenName: joaquim.manoel
    uid: joaquim.manoel
    uidNumber: 1025
    homeDirectory: /home/joaquim.manoel
    loginShell: /bin/bash
    gecos: System User
    userPassword:: e1NTSEF9YlU5UHZpbWlCUzQxT1NCSDVaaHFHRGtKUk8xVFVWRlY=
    shadowLastChange: 14673
    shadowMax: 45
    gidNumber: 513
    telephoneNumber: 123-4567
    telephoneNumber: 765-4321
    sn: joaquim manoel
    
    # search result
    search: 2
    result: 0 Success
    
    # numResponses: 2
    # numEntries: 1
    
  4. Para deletar um atributo: Criar um arquivo com o seguinte conteúdo:
    # begin
    
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    changetype: modify
    delete: telephoneNumber
    telephoneNumber: 765-4321
    
    # end
    
    Executar o Comando:
    ldapmodify -D "cn=manager,dc=example,dc=com" -v -W -f delattr.ldif 
    
    Resultado:
    ldap_initialize(  )
    Enter LDAP Password: 
    delete telephoneNumber:
       765-4321
    modifying entry "uid=joaquim.manoel,ou=People,dc=example,dc=com"
    modify complete
    
  5. Para deletar uma entrada: Criar um arquivo com o seguinte conteúdo:
    # begin
    dn: uid=joaquim.manoel,ou=People,dc=example,dc=com
    changetype: delete
    
    # end
    
    Executar o Comando:
    ldapadd -D "cn=manager,dc=example,dc=com" -v -W -f delete.ldif 
    
    Resultado:
    ldap_initialize(  )
    Enter LDAP Password: 
    deleting entry "uid=joaquim.manoel,ou=People,dc=example,dc=com"
    delete complete
    
IP
3.235.179.111