17

Using command-line (Linux) or LDIF, I could find many examples of creating a new group and defining its members, but no examples of this:

How to add a user to an existing group?

Let's say the person also already exists.

For instance adding user uid=fred,ou=people,dc=example,dc=com to group cn=vipb,ou=groups,dc=example,dc=com.

Nicolas Raoul
  • 1,334
  • 7
  • 22
  • 43

1 Answers1

21

You add a memberUid attribute to the group. For example:

$ ldapmodify -D <admin DN> -h <ldaphost>
password: [enter password]
dn: cn=vipb,ou=groups,dc=example,dc=com
changetype: modify
add: memberUid
memberUid: fred

^D

For the record, the LDAP schema is described in RFC 2307.

Tom Shaw
  • 3,752
  • 16
  • 23
  • By the way, I recommend using a point-and-click LDAP browser to get a feel for your LDAP structure and schema. Back in the day I used [JXplorer](http://jxplorer.org/) but there may be better ones these days. – Tom Shaw Jun 01 '11 at 12:30
  • 3
    [Apache Directory Studio](https://directory.apache.org/studio/) is a good alternative. – kara deniz Nov 23 '15 at 19:43