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.

Mail Accounts missing.

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

  1. FeeL

    FeeL Well-Known Member

    Joined:
    Apr 17, 2004
    Messages:
    135
    Likes Received:
    2
    Trophy Points:
    18
    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!
     
  2. FeeL

    FeeL Well-Known Member

    Joined:
    Apr 17, 2004
    Messages:
    135
    Likes Received:
    2
    Trophy Points:
    18
    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!
     
  3. Oras

    Oras Registered

    Joined:
    Oct 5, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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:
    6
    CPanel support

    Hi,

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

    Catalin
     
Loading...

Share This Page