Index: [Article Count Order] [Thread]

Date:  Sun, 6 Aug 2006 20:09:01 +0200
From:  Michael Stauber <bq (at mark) solarspeed.net>
Subject:  [coba-e:06219] Re: Funnies
To:  coba-e (at mark) bluequartz.org
Message-Id:  <200608062009.01198.bq (at mark) solarspeed.net>
In-Reply-To:  <F07DD4D0940AFF41A207BE85479D2AFF181382 (at mark) server.mainline.local>
References:  <F07DD4D0940AFF41A207BE85479D2AFF181382 (at mark) server.mainline.local>
X-Mail-Count: 06219

Hi Colin,

> On the old server we had a user john in vsite www.domain.tld
> John is no longer there and when I try and re-instate him BQ says I
> can't (presumably because it thinks he is already there)
> I have created a user john_new in the same vsite as before with an email
> alias of john and that works fine.
>
> Anybody any ideas?

I've been recently working on an update of my Automated Backup software and 
added a functionality for an automatic restore of CMU-exports, DNS and MySQL 
data. Example usage purpose: You export all data daily to a 2nd server, where 
it is automatically reimported on different IP addresses. In case of an 
outage of the primary server you just power the primary down and renumber the 
IPs on the 2nd server to the IPs that the sites were on before (with a 
provided script or through the GUI).

While testing that stuff I've run into similar caveats as you have noticed: 
Sometimes when you delete a user, his home directory isn't deleted, or the 
directory one above his home directory (if it is empty after the removal) is 
not deleted propperly.

The next time you want to either import that user through CMU, or attempt to 
create him manually with the CLI tools or through the GUI, then it bugs out 
with "user cannot be created" or similar.

To fix it you have to locate the directory in question and need to delete it 
manually <sigh>.

In my case where I want to reset the server to near factory defaults (no sites 
or users on it) I simply delete all sites and then remove everything 
within /home/.sites/ and /home/.users/  (with the exception of user "admin" 
of course!!!).

So how to do it on a server where that isn't an option, as you want to 
preserve the sites and users already on it?

First locate where the site in question stores the users:

[root (at mark) cbq sites]# ls -al /home/sites/|grep www.mysite.com
lrwxrwxrwx   1 root root   19 Jul  3 22:44 www.mysite.com 
-> ../.sites/143/site2

Ok, so the site is located under /home/.sites/143/site2/

So we find its users here:

/home/.sites/143/site2/.users/

Now run this two commands:

ls -la /home/.sites/143/site2/.users/*/   
ls -la /home/.sites/143/site2/.users/*/*/   

If you find an empty directory with nothing in it, then that's the one you 
want/need to remove.

-- 

With best regards,

Michael Stauber