Home
|
UNIX
|
Oracle
|
Code
|
Practical
|
Private
Dovecot with mbox virtual hosts
Prepare the system
Prerequesties
Make sure you've got those packages installed,
rpm -q ntp dovecot
cd /etc
mv ntp.conf ntp.conf.dist
sed '/^$/d;/^#/d;' ntp.conf.dist > ntp.conf
vi ntp.conf
point to your prefered NTP serveurs e.g.,
server ntp1.dedibox.fr
server ntp.obspm.fr
Configuration
Check for configuration file location,
dovecot -n | head -1
Configure,
cd /etc
mv dovecot.conf dovecot.conf.dist
vi dovecot.conf
like,
protocols = pop3 imap
syslog_facility = mail
first_valid_uid = 8
disable_plaintext_auth = no
ssl_disable = yes
#mail_debug = yes
# for thunderbird (at least for thunderbird 1),
protocol imap {
login_greeting_capability = yes
imap_client_workarounds = tb-extra-mailbox-sep
}
auth default {
passdb passwd-file {
args = /etc/virtual/%d/passwd
}
userdb static {
args = uid=8 gid=12
}
}
mail_location = mbox:/var/spool/virtual/%d/%n.folders:INBOX=/var/spool/virtual/%d/%n
#mail_location = mbox:/var/spool/virtual/%d/%n.folders
Note. check UID and GID,
grep ^mail /etc/passwd
grep ^mail /etc/group
Note. if you want an alternate port e.g. for pop3,
#rotocol pop3 {
# listen = *:111
#
Run and enable the daemon,
service dovecot start
chkconfig dovecot on
check ports 110 and 143 are listening,
ps aux | egrep 'pop3|imap'
netstat -antp | grep LISTEN | grep 110
netstat -antp | grep LISTEN | grep 143
User administration
Create a virtual mail user,
cd /etc/virtual
./pop_passwd.pl user password >> example.net/passwd
create its IMAP folder and inbox symbolic link,
cd /var/spool/virtual
touch example.net/user
mkdir -p example.net/user.folders
#ln -s ../user example.net/user.folders/inbox
Fix perms,
chown -R mail:mail /etc/virtual
chown -R mail:mail /var/spool/virtual
find /etc/virtual -type d -exec chmod 700 {} \;
find /etc/virtual -type f -exec chmod 600 {} \;
find /var/spool/virtual -type d -exec chmod 700 {} \;
find /var/spool/virtual -type f -exec chmod 600 {} \;
Clean-up subscriptions,
cd /var/spool/virtual/example.net/user.imap
for dir in `find . -type d -name .imap`; do rm -rf $dir; done
References