Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 2nd November 2006, 21:53
desmondk desmondk is offline
Junior Member
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 4 Times in 2 Posts
Default ispconfig email login with user@domain How to

For those that want to log into your email with user@domain here it is.
In ispconfig control panel , log in as admin and go to Management -> system config -> settings -> ISP manager ; and change "User Prefix" to [DOMAIN]_

We wil be using couriers userdb for authentication purposes.
Users wil now be added to the system as domain_user using the ispconfig frontend.

Edit authdaemonrc located at /etc/courier/ (on my ubuntu system) and change the line reading authmodulelist so it look like this

authmodulelist="authuserdb authpam"
Save and restart courier authdaemon.

Here is the code for the script that wil convert the text to user@domain that you would be able to login in with


rm -rf /etc/courier/userdb
touch /etc/courier/userdb
chmod 600 /etc/courier/userdb
for line in `pw2userdb2 | grep -ir user`
        domain=$( echo $line | cut -d"$delim" -f1 )
        useruid=$( echo $line | cut -d"$delim" -f2 )
        username=$( echo $useruid | cut -d'     ' -f1 )
        uid=$( echo $useruid | cut -d'  ' -f2 )
        gid=$( echo $line | cut -d"$delim" -f3 )
        home=$( echo $line | cut -d"$delim" -f4 )
        shell=$( echo $line | cut -d"$delim" -f6 )
        password=$( echo $line | cut -d"$delim" -f7)
        echo "$username@$domain $uid|$gid|${home}_$username|$shell|$password|/var/www/www.$domain/user/${domain}_$username/Maildir" >> /etc/courier/userdb

Also replace pw2userdb that is located in /usr/sbin on my system , it may be at a dif location to mine, in that case just use the following command to see where the file is located "which pw2userdb" and replace the code inside with this:
#! /usr/bin/perl
#  Convert /etc/passwd and /etc/shadow to userdb format.
#  $Id: pw2userdb.in,v 1.5 2000/07/19 11:55:15 mrsam Exp $
# Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
# distribution information.

use Getopt::Long;

#  Some undocumented options here (for vchkpw2userdb)

die "Invalid options.\n" unless
        GetOptions("passwd=s" => \$passwd, "shadow=s" => \$shadow,
                "noshadow" => \$noshadow, "nouid" => \$nouid,
                "domain=s" => \$domain, "vpopuid" => \$vpopuid );

($dummy, $dummy, $fixed_uid, $fixed_gid)=getpwnam("vpopmail")
        if $vpopuid;

$passwd="/etc/passwd" unless $passwd =~ /./;
$shadow="/etc/shadow" unless $shadow =~ /./;

$domain="" unless $domain =~ /./;
$domain="\@$domain" if $domain =~ /./;

open(PASSWD, $passwd) || die "$!\n";

while (<PASSWD>)
        chop if /\n$/;
        next if /^#/;
        ($acct,$passwd,$uid,$gid,$name,$home,$shell)=split( /:/ );

        ($uid,$gid)=($fixed_uid,$fixed_gid) if $vpopuid;

        $PASSWORD{$acct}=$passwd if $passwd ne "x";

        $name =~ s/\|/./g;      # Just in case
close (PASSWD);

if ( -f $shadow && ! $noshadow)
        open (SHADOW, $shadow) || die "$!\n";
        while (<SHADOW>)
                next if /^#/;
        close (SHADOW);

while ( defined ($key=each %UID))
        print "$key$domain\tuid=$UID{$key}|gid=$GID{$key}|home=$HOME{$key}" .
                ( $SHELL{$key} =~ /./ ? "|shell=$SHELL{$key}":"") .
                ( $PASSWORD{$key} =~ /./ ? "|systempw=$PASSWORD{$key}":"") .
                ( $GECOS{$key} =~ /./ ? "|gecos=$GECOS{$key}":"") .
        print "$UID{$key}=\t$key\n" unless $nouid;

Put he first script in a crontab to remake the userdb file. like this: run the command "crontab -e"
Add into the file:
*/5 * * * * /location_of_the_script/script_name
And Save.

I am busy changing the script so that it would check to see if there has been any changes made before rebuilding the userdb file and if there wasn't any changes it won't do anything.
Hope this helps some people in the mean time. Still busy improving it.
Reply With Quote
The Following 2 Users Say Thank You to desmondk For This Useful Post:
Telesat (8th September 2007), TimeJunky (11th April 2007)
Sponsored Links


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot send email from OE through ISPconfig site tomd General 10 12th March 2009 07:05
SP-Server Setup - Ubuntu 5.10 "Breezy Badger" - Page 6 (changes) LuisC-SM HOWTO-Related Questions 0 21st April 2006 16:16
ISPConfig 2.2.0 problem with email addresses DataJet General 1 29th March 2006 14:29
Debian Sarge, ISPConfig, perfect setup followed, email can't login! Zoon Installation/Configuration 3 12th February 2006 21:58
ISP-Ubuntu breezy ispconfig dns email e-mail working finally yellowjelly HOWTO-Related Questions 0 19th November 2005 21:30

All times are GMT +2. The time now is 08:00.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.