The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Manual user import with /var/cpanel/users

Discussion in 'General Discussion' started by Blasted_Heath, Sep 7, 2006.

  1. Blasted_Heath

    Blasted_Heath Member

    Joined:
    Dec 19, 2004
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    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?
     
  3. Blasted_Heath

    Blasted_Heath Member

    Joined:
    Dec 19, 2004
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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)
     
  4. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    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";
    }
    
     
  5. TimTim

    TimTim Registered

    Joined:
    Jan 14, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  6. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    Do the files in /var/cpanel/users have the correct data, and are they chmodded and chowned correctly?
     
  7. TimTim

    TimTim Registered

    Joined:
    Jan 14, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Everything in there seems to be correct which baffles me.
     
  8. TimTim

    TimTim Registered

    Joined:
    Jan 14, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  9. Akira Web

    Akira Web Member

    Joined:
    Apr 12, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I've never ran into this myself, but it would be nice if someone had a suggestion to this issue if it ever came up again.
     
Loading...

Share This Page