2

I'm trying to install exim + dovecot on my centOS server. And when i tried to run( as root ) it, I am getting the below message:

Starting Dovecot Imap: Error: Can't write to log directory /var/log: Permission denied Fatal: Invalid configuration in /etc/dovecot.conf

I even tried to set permissions to 777, but that didn't help. Also I had the same problem with dovecot.conf, I solved this by deleting dovecot.conf and creating it again. Would appreciate for any help. My dovecot.conf looks like this:

log_path = /var/log/dovecot.log

login_greeting = pop3/imap service.

protocol imap {

}

protocol pop3 {

}
pop3_uidl_format = %08Xu%08Xv

protocol lda {

  postmaster_address = postmaster@example.com

  mail_plugin_dir = /usr/lib/dovecot/lda

}

auth default {

  mechanisms = plain login cram-md5 digest-md5

  passdb passwd-file {

  args = /etc/dovecot.passwd

  }

  userdb passwd-file {

  args = /etc/dovecot.passwd

  }

  user = root

  socket listen {

 client {

`}
1

Note that the message is can't write to log directory /var/log It's not clear from your post whether you changed the permissions on /var/log or on /var/log/dovecot.log.

/var/log is typically owned by root with permissions 755. dovecot is supposed to be run as root:

Normally Dovecot logs everything through its master process, which is running as root.

from the dovecot Local Delivery Agent wiki.

All of this leads me to suspect you are somehow starting dovecot as some other non-root user. Please supply info on how exactly you are starting dovecot. Typically it's done by a system startup script (as root). Alternately you can try launching dovecot on the command line as root with

sudo /usr/sbin/dovecot

and see if that works. That's just for troubleshooting though, you need to launch it automatically via a system startup script.

1

This is an old thread, but I had a similar problem recently so set about fixing it.

I had a server with dovecot apparently running as a non-root user (parent process running as root, but child processes for services running as mail). This can sometimes happen if you manage a server with a third-party control panel which configures various services or applications with non-standard permissions.

With no logrotate rule configured for them the server ended up nearly filling its disk, but after deleting the logs and restarting the dovecot service: no incoming mail was being delivered despite the log files being initially created OK! (I didn't need to touch the files).

I didn't notice this problem until a test email, sent after the first dovecot restart, didn't arrive. However I subsequently received a message delay notification to my sending test account, containing the dovecot.log error message from the server.

I first ran ps aux | grep dovecot to identify the running user - it indicated some processes running as root but others running as mail.

In the server's dovecot.conf, for all of the service declarations it also had user = mail and group = mail lines.

So, I ran (either as root, or using sudo)

chown mail:mail /var/log/dovecot*.log

then ran service dovecot restart

and emails began to flow again. NB that on this particular machine, dovecot.log only logged service restarts as it was set to verbose logging; all the other info filed into dovecot-info.log and dovecot-debug.log.

I could see emails arriving and being delivered by tailing the mail log:

tail -fn 100 /var/log/maillog (this might be named something like mail.log for you).

0

Of course, you can keep trying to solve it and I am sure you will, but in such cases when things just go messy, the fastest (not best) way is to:

yum remove dovecot
yum install dovecot

You're done ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.