0

I am in the process of setting up a mail server and I was hoping to get some help. It starts with Roundcube webmail, when I tried to login with an existing correct user name and password it gives me 'Login failed' so I checked the error log at /var/log/mail.log and I found out that there is an error that says

dovecot: auth-worker(10370): Error: sql([email protected],127.0.0.1): Password query 
failed: You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to 
use near ''maildir:/var/vmail/...' as userdb_mail, 150 as userd' at line 1

and when I check the password query at /etc/dovecot/dovecot-sql.conf.ext

password_query = \
  SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, \
  'maildir:/var/vmail/%d/%n' as userdb_mail, 150 as userdb_uid, 8 as userdb_gid \
  FROM mailbox WHERE username = '%u' AND active = '1'

which seems to be right?

Does anybody have an idea?

2
  • Do you have used the postfixadmin as mail management tool?
    – Kondybas
    Dec 6, 2014 at 21:31
  • yes i did tht @Kondybas
    – fudu
    Dec 6, 2014 at 21:32

1 Answer 1

2

Change your config-file with SQL-query like that:

. . . . .
password_query= SELECT username as user, \
                       password \
                  FROM mailbox \
                 WHERE username = '%n@%d' \
                   AND active=1

user_query = SELECT maildir AS userdb_home, \
                        150 AS userdb_uid, \
                          8 AS userdb_gid, \
               FROM mailbox \
              WHERE username = '%n@%d' \
                AND active=1

iterate_query = SELECT username AS user FROM mailbox
. . . . .

Keep in mind that there is no characters except [ENTER] allowed after backslashes.

Add the next block to the config.local.php of the postfixadmin:

. . . . .
$CONF['maildir_name_hook'] = 'mdname';
function mdname ($domain, $user) {
    $part=explode("@", strtolower($user) );
    return sprintf("/var/vmail/%s/%s/", $part[1], $part[0]);
}
. . . . .
2
  • I have tried the change you come up with but unfortunately it didn't work. Now Roundcube gives a message Connection to storage server failed. and the mail error log also have an error that says dovecot: auth-worker(15305): Error: sql([email protected],127.0.0.1): User query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM mailbox WHERE username = '[email protected]' AND active=1' at line 1 and I did exactly the same as your when it comes to the SQL syntax.
    – fudu
    Dec 7, 2014 at 11:18
  • 1
    Dovecot and roundcube can be configured in a hundreds different styles. I can guess obvious but I can't guess everything.
    – Kondybas
    Dec 7, 2014 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .