Manual user import with /var/cpanel/users

Blasted_Heath

Member
Dec 19, 2004
12
0
151
Hi there, due to a HDD failure we've had to evacuate all our data to a new server, we have all client data, but I cannot get whm to pick up on the users (Copied manually, we don't have backups of them all)

How do I get whm to recognise the accounts with the following data:
/var/cpanel/users <- intact
The old /usr/local/apache/conf/httpd.conf

I have all the accounts homedirs copied into place also.

As far as I can tell the only thing in /scripts which rebuilds users only rebuilds /var/cpanel/users from apache's config, and doesn't attempt to readd them to whm.
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
To the best of my knowledge, WHM lists users based just on the files in /var/cpanel/users.

It may also rely on system users - did you recreate the system accounts with the /etc/passwd file?
 

Blasted_Heath

Member
Dec 19, 2004
12
0
151
After reading up on this we discovered that yes, it does just use that.

However, it requires they are all chowned to cpanel:username - and with over 800 files to do, we're trying to work out how to set them all properly with a script.

(We merged our old /etc/passwd, shadow and group files with the new ones, so the users and groups exist)
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
This should do it for you:

Code:
#!/usr/local/bin/perl
$dir = "/var/cpanel/users";
opendir(DIR, $dir);
@files = grep(/^[^.]/,readdir(DIR));
closedir(DIR);

foreach $file (@files) {
   print "chowning cpanel:$file $dir/$file\n";
   chown "cpanel", $file, "$dir/$file";
}
 

TimTim

Registered
Jan 14, 2005
4
0
151
elleryjh said:
This should do it for you:

Code:
#!/usr/local/bin/perl
$dir = "/var/cpanel/users";
opendir(DIR, $dir);
@files = grep(/^[^.]/,readdir(DIR));
closedir(DIR);

foreach $file (@files) {
   print "chowning cpanel:$file $dir/$file\n";
   chown "cpanel", $file, "$dir/$file";
}
I know the OP and I'm trying to help him out with this and we've run into this issue.

In WHM everything looks ok but when you go into cpanel everyone seems to have become username.yourdomain.com and the package and limits don't display on the sidebar and there is quite a few [an error occurred while processing this directive] messages appearing. I'm at a bit of a loss to figure this out, does anyone have experience manually importing cPanel client like this?
 

elleryjh

Well-Known Member
Apr 12, 2003
479
0
166
Do the files in /var/cpanel/users have the correct data, and are they chmodded and chowned correctly?
 

TimTim

Registered
Jan 14, 2005
4
0
151
TimTim said:
Everything in there seems to be correct which baffles me.
I've fixed the issue, it turned out when rebuilding /etc/group manaully I might of messed up the numbering scheme putting people in the wrong groups.... :rolleyes:

Now if someone could tell me if there was a way to rebuild /etc/proftpd/ with all the correct users and group id's I'd be grateful.