Home › Forums › OS X Server and Client Discussion › Questions and Answers › How do you automate moving entries from Users to People container?
- This topic has 2 replies, 2 voices, and was last updated 19 years, 1 month ago by
melmaninga.
-
AuthorPosts
-
April 29, 2007 at 1:30 am #368865
melmaninga
ParticipantI would like to have all of our IT systems (computers, phones, printers, etc.) looking at our OD master for directory services and information.
For the systems that just need directory information, I would like them to look at the People container and not the Users container. I would like the People container to only contain basic contact information (ie givenName sn l st postalCode c mail street telephoneNumber mobile facsimileTelephoneNumber).
I was thinking it would be a good idea to automate the regular population of the People container using launchd, so it becomes a simple process that runs automatically. Maybe use launchd to do an ldapsearch to find all of our users with uidNumbers 2000-3999 (these are the only users we want) with just the attributes I want to publish.
Then use awk to change cn=Users to cn=People and using ldapadd to add the output back into LDAP. On the next run of the script I could use ldapsearch on the Users container + ldapdelete to clear the People container of the entries about to come over and then the ldapsearch + awk + ldapadd to populate the People container again.
From the look of it this is pretty simple to do. I’ve already done some initial trials with really simple scripts. But I do have two questions, I suppose:
One: Is this the easiest “quick and dirty”, “fire and forget solution” for automatically populating the People container?
Two: I am new to the ldapsearch command. I am trying to use the ldapsearch command to generate an ldif file that has a listing of all my users with a uid of 2000-3999. How do you set up an ldap filter to get a range for the desired uidNumber’s?
April 30, 2007 at 4:17 am #368869melmaninga
Participant[QUOTE][u]Quote by: MacTroll[/u][p]1) while ldapsearch and LDIFs are a very valid way to do this, and probably the way you’ll end up going, it would be also possible to do this with dscl. As that will allow you to get and set cn=people using all Apple-developed tools.
Cool.
Can you give hints as to how you might do it? You don’t have to write the complete code, but if you could just point me in the right direction it would be excellent.
Can dscl delete copy every entry in a container to another with only selected attributes? How can dscl delete every entry in a container?
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed