Automation: how to change LDAP attribute for all users: Difference between revisions

(Created page with "= Zimbra Automation = {{KB|{{ZC}}|{{ZCS 8.0}}||}} {{WIP}} Zimbra automation using scripting. == How to change user's individual signatures based on their ldap attributes gl...")
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Zimbra Automation =
{{BC|Certified}}
{{KB|{{ZC}}|{{ZCS 8.0}}||}}
__FORCETOC__
<div class="col-md-12 ibox-content">
== Zimbra Automation: How to change an LDAP attribute for all users ==
{{KB|{{ZC}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}|}}
{{WIP}}
{{WIP}}
==== 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
sleep 2


Zimbra automation using scripting.
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


== How to change user's individual signatures based on their ldap attributes globally ==
EOF


----
done
==== Purpose ====
</pre>
{{Article Footer|Zimbra Collaboration 8.7, 8.6, 8.5, 8.0|10/02/2015}}
{{NeedSME|SME1|SME2|Copyeditor}}
[[Category:LDAP]]

Latest revision as of 19:13, 3 October 2015

Zimbra Automation: How to change an LDAP attribute for all users

   KB 22377        Last updated on 2015-10-3  




5.00
(one vote)

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
sleep 2

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
Verified Against: Zimbra Collaboration 8.7, 8.6, 8.5, 8.0 Date Created: 10/02/2015
Article ID: https://wiki.zimbra.com/index.php?title=Automation:_how_to_change_LDAP_attribute_for_all_users Date Modified: 2015-10-03



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by SME1 SME2 Copyeditor Last edit by Jorge de la Cruz
Jump to: navigation, search