[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: How do I copy a user password from one server to another using tools provided in OpenLDAP Software



This is a fairly trivial task... Here's a simple bash script that would achieve your desired results, although I would recommend writing your own tool in a more sophisticated language such as perl as this is hardly foolproof or all-encompassing.

#!/bin/bash

SRCHOST='127.0.0.1'
DSTHOST='1.2.3.4'

SRCUSER='cn=read_user,o=org'
SRCPASS='source_password'

DSTUSER='cn=root_or_write_dn,o=org'
DSTPASS='write_password'

COPY='cn=dn_of_user_to_copy,o=org'
ATTR='userPassword'

LINE=$(ldapsearch -h $SRCHOST -D $SRCUSER -w $SRCPASS -x -b $COPY $ATTR |grep "^$ATTR:")

ldapmodify -h $DSTHOST -D $DSTUSER -w $DSTPASS -x <<-EOF
	dn: $COPY
	replace: $ATTR
	$LINE
EOF



> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org [mailto:owner-openldap-
> software@OpenLDAP.org] On Behalf Of Latte Coffee
> Sent: Saturday, August 12, 2006 2:25 PM
> To: openldap-software@OpenLDAP.org
> Subject: How do I copy a user password from one server to another using
> tools provided in OpenLDAP Software
> 
> Does OpenLDAP Software include a tool for copying a user password from one
> server to another?