adding/editing LDAP group

Print Friendly, PDF & Email

Randy recently asked me to add some students to the cs251stu group.  There is a script that does that, addLDAPusertogroup.pl, but it (1) doesn’t add anything to the entry in /etc/group, and (2) just appends new members.  In this case, the member list was getting kinda long, including many students who had graduated or simply taken the course in the past.

So, I did the operation as follows:

* edit /etc/group to remove the old entries and put the new entries in

* extract just that line, say by grep “^cs251stu:” /etc/group > /root/acctmp/cs251stu.group

* convert that to LDIF:  migrate_group.pl cs251stu.group > cs251stu.ldif

* delete the old group from LDAP:  ldapdelgroup cs251stu

* add the new group to LDAP:  ldapadd2 cs251stu.lif

* confirm the results:  ldapsearchgroup cs251stu

Here’s an edited history:

1001 grep cs251stu /etc/group > /root/acctmp/cs251stu.group
1002 emacs -nw /root/acctmp/cs251stu.group
1010 migrate_group.pl cs251stu.group > cs251stu.ldif
1017 ldapsearchgroup cs251stu
1018 ldapdelgroup cs251stu
1020 ldapadd2 cs251stu.ldif 
1021 ldapsearchgroup cs251stu

We should think about ways to automate this process a bit better.

Scott

About CS SysAdmins

The CS Department System Administrators
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *