3.8. Using Binary Attributes

Certain attributes support binary values, such as the jpegPhoto attribute. When you add or update such an attribute, the utility reads the value for the attribute from a file. To add or update such an attribute, you can use the -b binary option of the ldapadd or ldapmodify utility, or the standard LDIF notation.
For example, to add the jpegPhoto attribute to the uid=user,ou=People,dc=example,dc=com entry, and read the value for the attribute from the ~/photo.jpg file:
  • Using the binary option: Pass the -b option to the command, and set the binary attribute to the path of the file:
    # ldapmodify -b -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    
    dn: uid=user,ou=People,dc=example,dc=com
    changetype: modify
    add: jpegPhoto
    jpegPhoto: ~/photo.jpg
  • Using standard LDIF notation: Set the attribute's value to the path of the file using the < file:path_to_file syntax:
    # ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    
    dn: uid=user,ou=People,dc=example,dc=com
    changetype: modify
    add: jpegPhoto
    jpegPhoto: < ~/photo.jpg