Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Mail Accounts missing.

Discussion in 'E-mail Discussion' started by FeeL, Nov 9, 2004.

  1. FeeL

    FeeL Well-Known Member

    Joined:
    Apr 17, 2004
    Messages:
    135
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    Rio de janeiro
    cPanel Access Level:
    Reseller Owner
    After restoring a Backup, all the mail accounts are missing at Cpanel. Thi user files are there, but are missing @ the Cpanel and cannot be retrived by the users.
    I've tryed many tipes of backup recovery, but nothing worked out...

    Any ideas?

    Tnx!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. FeeL

    FeeL Well-Known Member

    Joined:
    Apr 17, 2004
    Messages:
    135
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    Rio de janeiro
    cPanel Access Level:
    Reseller Owner
    the ~/etc/passwd file was empty, for some reason.

    I've found the file, and other missing files, @ the ~/etc/passwd/domainame , and manualy copied on the ~/etc directory.

    After that, the CPanel staff gave me this script to fix it.

    #!/usr/bin/perl

    # warning: this won't work right if there are addon or parked domains

    use strict;
    use warnings;
    use Cwd;

    die "Supply user as first argument" if !defined $ARGV[0];

    my $usr = $ARGV[0];
    my $ent = `cat /etc/passwd |grep ^$usr:`;
    chomp $ent;
    die 'Invalid user' if !$ent;
    my (undef,undef,$uid,$gid,undef,$hom,$shl) = split /:/, $ent;

    my ($dom) = `cat /etc/trueuserdomains |grep $usr` =~ m/^([^:]*):/;
    die "Could not find domain for specified user" if !defined $dom ||
    !$dom;

    $hom =~ s/\/$//;
    chdir "$hom/etc" or die $!;
    my $dir = getcwd;
    die 'Could not chdir' if $dir ne "$hom/etc";

    open SHD, './shadow' or die $!;
    open PSS, '> ./passwd' or die $!;

    while(<SHD>) {
    my ($u) = $_ =~ m/^([^:]*):/;
    print "Fixing $u..." if defined $ARGV[1] && $ARGV[1];
    print PSS "$u:x:$uid:$gid\::$hom/mail/$dom/$u:$shl\n";
    print "Done\n" if defined $ARGV[1] && $ARGV[1];
    }

    close PSS;
    close SHD;

    print `chown $usr:mail ./passwd`;


    If someone else have this problem, ther goes the solution!

    Thank Dan!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Oras

    Oras Registered

    Joined:
    Oct 5, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    Location:
    Iraq
    GREAT ... Thanx Dear ... I really benifited from it ... :)
     
  4. toma1708

    toma1708 Active Member

    Joined:
    Aug 30, 2001
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    306
    CPanel support

    Hi,

    Perhaps CPanel support can fix this problem ASAP as it is extremely annoying.

    Catalin
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice