Automation: how to change LDAP attribute for all users: Difference between revisions
No edit summary |
|||
Line 10: | Line 10: | ||
---- | ---- | ||
==== Purpose ==== | ==== Purpose ==== | ||
The purpose of this script is to show how a single attribute value can be changed for all users in LDAP. The reason I made this article was an incident, where all mobile users were unable to sync, because their '''zimbraCreateTimestamp''' attribute value was in the future. This script explains how to change the value of this attribute for all users. | |||
---- | |||
==== Script ==== | |||
<pre style="white-space: pre-wrap; | |||
white-space: -moz-pre-wrap; | |||
white-space: -pre-wrap; | |||
white-space: -o-pre-wrap; | |||
word-wrap: break-word;"> | |||
#!/bin/bash | |||
echo "setting ldap variables" | |||
source ~/bin/zmshutil | |||
zmsetvars | |||
for i in `ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password | grep uid=| cut -d : -f 2 | sed 's/^\ //g'` | |||
do | |||
ldapmodify -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password << EOF | |||
dn: $i | |||
changetype: modify | |||
replace: zimbraCreateTimestamp | |||
zimbraCreateTimestamp: 20140918100701Z | |||
EOF | |||
done | |||
</pre> |
Revision as of 02:20, 2 October 2015
Zimbra Automation
- This article is a Work in Progress, and may be unfinished or missing sections.
Zimbra automation using scripting.
How to change an LDAP attribute for all users
Purpose
The purpose of this script is to show how a single attribute value can be changed for all users in LDAP. The reason I made this article was an incident, where all mobile users were unable to sync, because their zimbraCreateTimestamp attribute value was in the future. This script explains how to change the value of this attribute for all users.
Script
#!/bin/bash echo "setting ldap variables" source ~/bin/zmshutil zmsetvars for i in `ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password | grep uid=| cut -d : -f 2 | sed 's/^\ //g'` do ldapmodify -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password << EOF dn: $i changetype: modify replace: zimbraCreateTimestamp zimbraCreateTimestamp: 20140918100701Z EOF done