Post

Troubleshooting Commands For Dovecot

Troubleshooting Commands For Dovecot

Overview

This is a recap of commands that I use to troubleshoot.

Dovecot Troubleshooting Commands

Configuration Checking Commands

View current Dovecot configuration:

1
doveconf -n

Shows the active Dovecot configuration (non-default values only)

Check specific configuration sections:

1
2
3
doveconf -n | grep -A5 "passdb"
doveconf -n | grep -A10 "service auth"
doveconf -n | grep protocols

Filters configuration output for specific sections

View specific lines from config files:

1
sed -n '135,145p' /etc/dovecot/conf.d/10-auth.conf

Displays lines 135-145 from a file (useful for debugging specific line errors)

Service Management Commands

Restart and check Dovecot status:

1
2
systemctl restart dovecot
systemctl status dovecot

Restarts the Dovecot service and shows its current status

Check running Dovecot processes:

1
2
3
ps aux | grep dovecot
ps aux | grep dovecot/auth
ps aux | grep dovecot/lmtp

Lists running Dovecot processes and specific service components

Authentication Testing Commands

Test user authentication:

1
doveadm auth test 'username@domain.com' 'password'

Tests if authentication works for a specific user

Look up user information:

1
2
doveadm user username@domain.com
doveadm auth lookup username@domain.com

Retrieves user details from the userdb

List supported password schemes:

1
doveadm pw -l

Shows all password encryption schemes Dovecot supports

Generate password hash:

1
2
doveadm pw -s ARGON2I -p 'password'
doveadm pw -s BLF-CRYPT -p 'password'

Creates encrypted password hashes for database storage

Database Testing Commands

Test MySQL connection:

1
mysql -u postfixadmin -p -h 127.0.0.1 -e "SELECT 1;" postfixadmin

Verifies database connectivity with the PostfixAdmin database

Query mailbox table:

1
mysql -u postfixadmin -p postfixadmin -e "SELECT username, password, active FROM mailbox WHERE username='user@domain.com';"

Checks user data in the PostfixAdmin database

Log Analysis Commands

View Dovecot logs:

1
2
3
journalctl -u dovecot -n 50
journalctl -u dovecot -n 50 | grep -i auth
journalctl -u dovecot -f

Shows recent Dovecot logs, filters for auth entries, or follows logs in real-time

View Postfix logs:

1
journalctl -u postfix -n 50 | grep -E "delivered|lmtp|status"

Shows Postfix logs filtered for delivery status

Check mail log (if exists):

1
tail -50 /var/log/mail.log

Shows recent entries from the traditional mail log file

Mail Queue Commands

Check mail queue:

1
mailq

Lists messages currently in the Postfix queue

Flush deferred mail:

1
postqueue -f

Forces retry of all deferred messages

Postfix Configuration Commands

View Postfix configuration:

1
2
postconf | grep -E "virtual_transport|mailbox_command"
postconf | grep -E "dovecot|lmtp"

Shows specific Postfix configuration parameters

File System Commands

Check file permissions:

1
2
3
ls -la /var/vmail/domain/user/
ls -la /var/run/dovecot/auth-*
ls -la /var/spool/postfix/private/dovecot-lmtp

Verifies permissions on mail directories and sockets

Search for configuration files:

1
2
find /etc/dovecot -name "*sql*" -o -name "*auth*" 2>/dev/null
grep -r "mail_plugins" /etc/dovecot/conf.d/

Locates specific configuration files or searches for text within configs

Network/Socket Commands

Check listening services:

1
2
ss -tulpn | grep dovecot
ss -ln | grep :24

Shows which ports or sockets Dovecot is listening on

Package Management Commands

Check installed packages:

1
2
dpkg -l | grep dovecot
apt list --installed | grep dovecot

Lists installed Dovecot-related packages

This post is licensed under CC BY 4.0 by the author.