Thanks Aki for the answer.

I did some tests and found a solution. I write down my experience It could be useful to someone.

First I putted  "passwd-file" passdb (only)  before "pam" passdb, as Aki suggested,
but "illegal seek error" persisted.

Then I putted both "passwd-file" passdb and "static" userdb before "pam" passdb and "passwd" userdb (used for local user),
but that generated a strange behavior because "static" driver overrides info also for local user.

Finally I putted both "passwd-file" passdb and "passwd-file" userdb before "pam" and "passwd"
and that works without errors.

My working dovecot config:

host-prompt# dovecot -n
# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-5-686-pae i686 Debian 7.11
auth_mechanisms = plain login
auth_username_format = %Ln
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
login_greeting = Server ready.
mail_full_filesystem_access = yes
mail_location = mbox:~/:INBOX=/var/mail/%u:INDEX=/var/index/%u
mail_privileged_group = mail
passdb {
  args = scheme=MD5-CRYPT username_format=%n /etc/dovecot/users
  driver = passwd-file
}
passdb {
  driver = pam
}
protocols = " imap"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  user = root
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
ssl_cert = </etc/ssl/certs/chained-cert-9599-ml.mat.unical.it.pem
ssl_key = </etc/ssl/private/csrkey-ml.mat.unical.it.pem
userdb {
  args = username_format=%n /etc/dovecot/users
  default_fields = mail=maildir:/var/vmail/%d/%n/Maildir/
  driver = passwd-file
  override_fields = uid=vmail gid=vmail home=/var/vmail/%d/%n
}
userdb {
  driver = passwd
}
verbose_proctitle = yes


host-prompt# cat /etc/dovecot/users
claudio.panetta:{MD5-CRYPT}$1$abcdefghijklmnopqrst:5000:5000::/var/vmail::
ciccio.pasticcio:{MD5-CRYPT}$1$abcdefghijklmnopqrst:5000:5000::/var/vmail::

At first I preferred (making a mistake) static driver versus passwd-file
to avoid writing uid,gid,home for each user, but in the end, with passwd-file and
override_fields i got the desired scenario.

Regards,
Claudio


Il 30/03/18 14:27, Aki Tuomi ha scritto:

      
On 30 March 2018 at 15:11 panetta <panetta@mat.unical.it> wrote:


Hi,

I recently configured dovecot to manage auth
for both local and virtual user.
When i login as a virtual user (claudio.panetta) I get the following 
message:

dovecot: auth: Error: 
passwd(claudio.panetta,160.97.62.1,<WLjlnZ9oRACgYT4B>): getpwnam() 
failed: Illegal seek

but login is ok and sending/receiving email is ok,
how can, if possible, I suppress this error message?

In the following my dovecot config:

host-prompt# dovecot -n
# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-5-686-pae i686 Debian 7.11
auth_mechanisms = plain login
auth_username_format = %Ln
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
login_greeting = Server ready.
mail_full_filesystem_access = yes
mail_location = mbox:~/:INBOX=/var/mail/%u:INDEX=/var/index/%u
mail_privileged_group = mail
passdb {
   driver = pam
}
passdb {
   args = scheme=MD5-CRYPT username_format=%n /etc/dovecot/users
   driver = passwd-file
}
protocols = " imap"
service auth {
   unix_listener /var/spool/postfix/private/auth {
     group = postfix
     mode = 0660
     user = postfix
   }
   user = root
}
service imap-login {
   inet_listener imap {
     port = 0
   }
}
ssl_cert = </etc/ssl/certs/chained-cert-9599-ml.mat.unical.it.pem
ssl_key = </etc/ssl/private/csrkey-ml.mat.unical.it.pem
userdb {
   driver = passwd
}
userdb {
   args = username_format=%n /etc/dovecot/users uid=vmail gid=vmail 
home=/var/vmail/%d/%n mail=maildir:/var/vmail/%d/%n/Maildir
   driver = static
}
verbose_proctitle = yes

host-prompt# cat /etc/dovecot/users
claudio.panetta:{MD5-CRYPT}$1$abcdefghijklmnopqrst
ciccio.pasticcio:{MD5-CRYPT}$1$abcdefghijklmnopqrst

Regards,
Claudio


Hi! Put the file based passdb before the pam one. Also not sure what you are trying to do with the static userdb. It looks like you wanted to use passwd-file?

Aki