Dovecot: Operation not permitted

centos6dovecot

Im using centos6 and centos web panel, postfix. I can send messages and login in roundcube. But i cant recieve messages.
Dovecot log:

Sep 09 13:52:31 lda(test@domain.su): Fatal: setuid(101) failed with
euid=5000(vmail): Operation not permitted (This binary should probably
be called with process user set to 101 instead of 5000(vmail)) please
advice me these settings:

  • first_valid_uid
  • last_valid_uid
  • first_valid_gid
  • last_valid_gid

And what permissions i should have on dovecot-lda

##
## Dovecot config file
##
listen = *
disable_plaintext_auth = no

protocols = imap pop3 lmtp sieve
auth_mechanisms = plain login

passdb {
    driver = sql
    args = /etc/dovecot/dovecot-mysql.conf
}

#userdb {
#driver = prefetch
#}

userdb {
    driver = sql
    args = /etc/dovecot/dovecot-mysql.conf
}

mail_location = maildir:/var/vmail/%d/%n
first_valid_uid = 101
#last_valid_uid = 5000
first_valid_gid = 0
#last_valid_gid = 12
mail_plugins = quota
mailbox_idle_check_interval = 30 secs
maildir_copy_with_hardlinks = yes

service imap-login {
    inet_listener imap {
        port = 143
    }
    inet_listener imaps {
        port = 993
        ssl = yes
    }
}

service pop3-login {
    inet_listener pop3 {
        port = 110
    }
    inet_listener pop3s {
        port = 995
        ssl = yes
    }
}

service lmtp {
    unix_listener lmtp {
        #mode = 0666
    }
}

service imap {
    vsz_limit = 256M
}

service pop3 {
}

service auth {
    unix_listener auth-userdb {
        mode = 0666
        user = vmail
        group = mail
    }

    # Postfix smtp-auth
    unix_listener /var/spool/postfix/private/auth {
        mode = 0666
        user = postfix
        group = postfix
    }
}
service auth-worker {
}
service dict {
    unix_listener dict {
        mode = 0666
        user = vmail
        group = mail
    }
}
service managesieve-login {
    inet_listener sieve {
        port = 4190
    }
    service_count = 1
    process_min_avail = 0
    vsz_limit = 64M
}

service managesieve {
}

ssl = yes
ssl_cert = </etc/pki/tls/certs/gog.uk.to.crt
ssl_key = </etc/pki/tls/private/gog.uk.to.key
ssl_verify_client_cert = no
ssl_ca =

lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
protocol lda {
    #mail_plugins = sieve
    mail_plugins = quota sieve
    postmaster_address = postmaster@your-domain.tld
}

protocol imap {
    mail_plugins = quota imap_quota trash
    #mail_plugins = trash
    imap_client_workarounds = delay-newmail
}

lmtp_save_to_detail_mailbox = yes

protocol lmtp {
    mail_plugins = quota sieve
    #mail_plugins = sieve
}

protocol pop3 {
    mail_plugins = quota
    #mail_plugins =
    pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}

protocol sieve {
    managesieve_max_line_length = 65536
    managesieve_implementation_string = Dovecot Pigeonhole
    managesieve_max_compile_errors = 5
}

dict {
    quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf
}

plugin {
    quota = dict:user::proxy::quotadict
    acl = vfile:/etc/dovecot/acls
    trash = /etc/dovecot/trash.conf
    sieve_global_path = /var/sieve/globalfilter.sieve
    sieve = ~/dovecot.sieve
    sieve_dir = ~/sieve
    sieve_global_dir = /var/sieve/
    #sieve_extensions = +notify +imapflags
    sieve_max_script_size = 1M
    #sieve_max_actions = 32
    #sieve_max_redirects = 4
}

log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot-info.log
debug_log_path = /var/log/dovecot-debug.log
mail_debug=no

Best Answer

I believe you ran into the same problem as I did:

Multiple UIDs
If you're using more than one UID for users, you're going to have problems running dovecot-lda, as most MTAs won't let you run dovecot-lda as root. Best solution is to use LMTP instead, but if you can't do that, there are two ways to work around this problem:

  1. Make dovecot-lda setuid-root.
  2. Use sudo to wrap the invocation of dovecot-lda.

Source: https://wiki2.dovecot.org/LDA#line-100

This is what I am doing after every update of the dovecot package:

sudo chgrp dovenull /usr/lib/dovecot/deliver
sudo chmod 04750 /usr/lib/dovecot/dovecot-lda
# optional: run postqueue to deliver queued mails immediately
postqueue -f

I'm running Ubuntu though, so you most probably will have to use a different group. I don't have a CentOS installation handy to look it up.