如何通过脚本添加Open Directory服务器?

在全新的映像计算机上通过shell脚本添加Open Directory服务器的最佳方法是什么?

我已经使用InstaDMG创build了一个新的映像,我想通过shell脚本添加Open Directory Server,而不必使用Directory Utility手动执行。

计算机不必绑定打开目录。 (客户端:10.5.7,服务器:10.4.11)

我发现了这个方法(部署工作室),我正在部署我的图像有脚本已经做开放目录绑定 – 我已经修改了脚本稍微给脚本的症结在这里回答我的问题。 这个例子只使用匿名绑定(没有明确绑定到OD服务器)

#!/bin/sh # Used ds_open_directory_binding.sh (v1.6) from Deploy Studio as a base for the explicit question. # I recommend downloading Deploy Studio (http://deploystudio.com) to see other methods but the crux # of how it is done can be read here. (eg. no error checking here) #Enable LDAPv3 Plugin defaults write /Library/Preferences/DirectoryService/DirectoryService "LDAPv3" Active 2>&1 chmod 600 /Library/Preferences/DirectoryService/DirectoryService.plist 2>&1 /usr/sbin/ipconfig waitall #Configure LDAP dsconfigldap -a 'server.example.com' 2>&1 #Restart DS killall DirectoryService sleep 5 #Create Search Policy dscl localhost -create /Search SearchPolicy CSPSearchPath 2>&1 #Create Contacts dscl localhost -create /Contact SearchPolicy CSPSearchPath 2>&1 #Add OD Server to the search path dscl localhost -append /Search CSPSearchPath '/LDAPv3/server.example.com' 2>&1 #Add OD Server to Contact Search Policy dscl localhost -append /Contact CSPSearchPath '/LDAPv3/server.example.com' 2>&1