Re: Modify homeDirectory SOLVED

Max <[email protected]> Fri, 05 Nov 2004 10:01:46 +0100
Newsgroups gmane.mail.jamm.user
Message-ID <[email protected]>
Keith T. Garner wrote:
> On Thu, Nov 04, 2004 at 04:02:26, Max said:
> 
>>Hi all
>>
>>I got Jamm 0.9.7-rc1 running on FreeBSD and /home is a symlink for 
>>/usr/home by default
>>and this is causing problem for jammCleaner.
>>I change the jamm.vmail.homedir in jamm.properties to 
>>/usr/home/vmail/domains.
>>All new users added can be deleted with jammCleaner the problem is the old 
>>users
>>having /home/vmail/domains as the homeDirectory.
>>So I have to change the homeDirectory for existing users.
>>
>>Is ldapsearch and ldapmodify the right way to do this?
> 
> 
> Yep, that's probably your best bet.
> 
> Keith
> 
Hi
I used ldapsearch requesting dn and filter for objectclass=JammMailAccount and send the output to fix.ldap
ldapsearch  -b "o=hosting,dc=domain,dc=net" "objectclass=JammMailAccount" dn > fix.ldap

Removed this 3 lines from fix.ldap
version: 2
search: 2
result: 0 Success

Now the fix.ldap look like this
# [email protected], userdomain.se, hosting, domain, net
dn: [email protected],jvd=userdomain.se,o=hosting,dc=domain,dc=net

# [email protected], userdomain.se, hosting, domain, net
dn: [email protected],jvd=userdomain.se,o=hosting,dc=domain,dc=net
.......

Used perl to add some new lines to fix.ldap
perl -pi -e 's/dc=net/dc=net\nchangetype: modify\nreplace: homeDirectory\nhomeDirectory: \/usr\/home\/vmail\/domains/g' fix.ldap

Now the fix.ldap look like this
# [email protected], userdomain.se, hosting, domain, net
dn: [email protected],jvd=userdomain.se,o=hosting,dc=domain,dc=net
changetype: modify
replace: homeDirectory
homeDirectory: /usr/home/vmail/domains

# [email protected], userdomain.se, hosting, domain, net
dn: [email protected],jvd=userdomain.se,o=hosting,dc=domain,dc=net
changetype: modify
replace: homeDirectory
homeDirectory: /usr/home/vmail/domains
.......

Finaly  make the update to ldap
ldapmodify  -v -x -W -D "cn=Manager,dc=domain,dc=net" -r -f fix.ldap



Hope this can help someone having the same problem

Max


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click