Re: Question about uid/guid

Jörg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.devel
Message-ID <[email protected]>
TheSin wrote:
> I just noticed that debian started adding account in the 1000 area, 
> which is what I used with my ispman setup on my production server, can 
> we write a command that can re read the ispman.conf and reset 
> uids/guids, and then call makeDomainDirectories and reset perms and make 
> an other util to get the files in the dirs?
> 
> I think this might be a useful tool, it might not get used often but in 
> my case i don't even know where to start on this problem, some of my 
> groups are now lmtp etc etc. very bad.

This is nothing I would try to do with ISPMan, because there is no code 
that would take care of uid/gid changes.

In fact, your problem isn't that tough afterall...

Just a rough ToDo list for you:  8)

1) export your ISPMan LDAP data, so you have all the old uids/gids.

2) change all posixAccount/posixGroup entries in LDAP to a new uid/gid
(depending on your LDAP knowledge this is the fun/complicated part ;))
For my part, I would recomend a little, tiny script that will add an 
fixed offset to your existing uidnumber/gidnumber attributes (either by 
ldapmodify or by textual substitution on an exported LDIF)
In fact, you could hack the ldifupdate script to do that for you...

3) If you didn't use ldapmodify (or a ldifupdate method) get your 
changed LDIF back into your LDAP server

4) change permissions of the domain/vhosts/users homedirs.
For a particular homedir this is easily done with find ("find <homedir> 
-user <olduid> | xargs chown <newuid>"). (analog with groups)
It's probably best to script this, too (as in 2.)

5) Congratulation, your done!

Note: You will probably have downtime between steps 2) and 4), because 
your users won't have proper access to their homedirs until you did the 
chown/chgrp!

So if you are comfortable with perl, I would suggest using ldifupdate as 
a framework to parse your LDAP and manipulate uids/gids accordingly.

If that isn't your thing, but you're good at sh-scripting, use a neat 
sh-script + ldifsearch + ldifmodify + glue to do the same thing.

Otherwise, you probably need to recover your old uids/gids or find 
somebody for one of the above tasks ;)

best regards, Joerg


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.