arpepper@cscfpc20:~$ sudo apt-get install dovecot-imapd
Or you might need the following, or possibly even a variation.arpepper@dovecot:~ dovecot --version 1.2.9 arpepper@dovecot:~
Versions of dovecot fromarpepper@dovecot:~ /usr/sbin/dovecot --version 1.2.9 arpepper@dovecot:~
ubuntu
vary. With the introduction of
dovecot 2.0 the syntax of the already arcane config files changed.
dovecot 2.0 does not seem to have been packaged for ubuntu
yet.
Presumably because it would make so much documented stuff not work.
Well, actually it might work, but would generate log file diagnostics
indicating the new syntax which should be used. 19 Oct 2012 - ubuntu
is
now providing version 2, but I have not had the energy to change the
tense of this entire page.
A major change affecting these examples is you must use
in place of the old/usr/lib/dovecot/imap -c ~/dovecot/dovecot.conf
/usr/sbin/dovecot -c ~/dovecot/dovecot.conf --exec-mail imap
E.g.arpepper@cscfpc20:~$ sudo dovecot -c mypath/myconf.conf
arpepper@cscfpc20:~$ sudo /usr/sbin/dovecot -c ~/dovecot/dovecot.conf
dovecot
is reasonably equivalent to the rimapd facility
which used to be provided as part of older imap server software.
E.g.arpepper@cscfpc20:~$ /usr/sbin/dovecot --exec-mail imap
Or, use your own config file too...arpepper@cscfpc20:~$ ssh -x dovecot.cscf -l arpepper /usr/sbin/dovecot --exec-mail imap * PREAUTH [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH] Logged in as arpepper 0 logout * BYE Logging out 0 OK Logout completed. arpepper@cscfpc20:~$
If you are usingarpepper@cscfpc20:~$ ssh -x dovecot.cscf.uwaterloo.ca -l arpepper /usr/sbin/dovecot -c /u/arpepper/dovecot.cscf/dovecot1.conf --exec-mail imap * PREAUTH [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH] Logged in as arpepper 0 logout * BYE Logging out 0 OK Logout completed. arpepper@cscfpc20:~$
dovecot 2
, then you call the imap
directly, instead of
the above. Seearpepper@cscfpc20:~$ ssh -x dovecot.cscf -l arpepper /usr/lib/dovecot/imap -c /u/arpepper/dovecot.cscf/dovecot1.conf
You want to get your mail client, such as thunderbird
, to talk to such
sessions. mutt
(Mail User Tool) can do that reasonably directly.
dovecot.conf
to use.
base_dir = /home/arpepper/var/run/dovecot1/ protocols = imap listen = 127.0.0.1 log_timestamp = "%Y-%m-%d %H:%M:%S " mail_location = mbox:~/mail:INBOX=~/inbox/%u mail_privileged_group = mail protocol imap { } protocol pop3 { pop3_uidl_format = %08Xu%08Xv } auth default { mechanisms = plain passdb pam { } userdb passwd { } user = root } dict { } plugin { }
Will start a server requiring authentication listening on the normal imap port on 127.0.0.1. You can create arbitrary such local servers for different purposes. E.g. 127.0.0.2, 127.0.0.3, etc. Or even addresses like 127.22.33.44. These will be accessible only to users logged on to the local machine, and will require authentication.arpepper@cscfpc20:~$ sudo /usr/sbin/dovecot -c myconf.conf
Using a mail client such as thunderbird
you should now be able to
add a mail account on server 127.0.0.1
or whatever you have chosen.
Multiple such private servers can be used to organize your mail in various ways.
For each such server you create, you need to specify a different /var/run directory, or confusion will result. The directories need to be created. To properly shutdown that daemon you could do something like...
Ideally you would create the directories somewhere which, like /var/run will be cleared at boot time.arpepper@cscfpc20:~$ pf=/home/arpepper/var/run/dovecot1/master.pid arpepper@cscfpc20:~$ sudo /sbin/start-stop-daemon --stop --quiet --pidfile $pf
dovecot.conf
to use.
protocols = imap
mail_location = mbox:~/mail:INBOX=~/inbox/%u
mail_privileged_group = mail
protocol imap {
}
auth default {
mechanisms = plain
passdb pam {
}
userdb passwd {
}
user = root
}
dict {
}
plugin {
}
That starts a pre-authenticated session on standard input. Note that at least some of the apparently null blocks are necessary in order to get imap protocol to work properly. The trick is to get a mail client such asarpepper@cscfpc20:~$ /usr/sbin/dovecot -c myconf.conf --exec-mail imap * PREAUTH [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS] Logged in as arpepper 0 logout * BYE Logging out 0 OK Logout completed. arpepper@cscfpc20:~/tmpdir$
thunderbird
to talk to that.
If your machine has the socket
command installed, you can use that.
That command will sit there working as a daemon. You can then inarpepper@cscfpc20:~/tmpdir$ /usr/bin/socket -f -l -p '/usr/sbin/dovecot -c myconf.conf --exec-mail imap' -B 127.0.0.1 -s 14446
thunderbird
specify server 127.0.0.1 as an imap
server, and afterwards go and change the port from 143 to 14446
(an arbitrary number; choose any one which is available).
The problem with that is that anyone who can sign on to your personal machine can connect to the service, and will be pre-authenticated as you.
If you don't have the socket
command, you might be able to compile an
equivalent from source. If you have sudo
privileges, you are better
to use sudo
to start privileged daemons requiring authentication, rather than use
sudo
to install the socket
command to later use non-sudo.
The socket
command is a way, however, to gain access on your local machine
to a mailbox on a remote machine to which you have indirect access. Once
again, however, it leaves a localhost port open for pre-authenticated
connection.
Note that mail_location isn't exactly a variable name; mail_ is actually a prefix used to indicate that the variable location is set for the appropriate process.
~/mail
.
It may also
be useful to specify somewhere
other than /var/mail/%u
as inbox (to avoid altering possible actual
inbox).
~/.maildir
. It may also
be useful to specify somewhere
other than /var/mail/%u
as inbox (to avoid altering possible actual
inbox).
Note that the mail_location
syntax does not let you specify one
mbox directory and one maildir directory. But you could accomplish
that by running two different dovecot
servers on your own machine,
or by using the imap namespace facility as implemented by dovecot
.
Actually, it's worse than that. Many months ago my mind slipped up when I gave that faulty example. It actually expects a maildir structure beneath /var/mail/%u for each user.
To have an mbox INBOX and maildir folders, you must use namespaces.
base_dir = /home/arpepper/var/run/dovecot9/ protocols = imap listen = 127.0.0.9 log_timestamp = "%Y-%m-%d %H:%M:%S " mail_location = mbox:~/nomail:INBOX=~/nomail/%u namespace private { inbox = yes hidden = no prefix = } namespace private { separator = / inbox = yes hidden = no prefix = "maildir/" location=maildir:~/.maildir } namespace private { separator = / inbox = no hidden = no prefix = "mbox/" location = mbox:~/mail:INDEX=~/.dovecot-indexes } protocol imap { } protocol pop3 { pop3_uidl_format = %08Xu%08Xv } auth default { mechanisms = plain passdb pam { } userdb passwd-file { args = /home/arpepper/dovecot/dovecot9/passwdext } user = root } dict { } plugin { }
arpepper@cscfpc20:~$ cat /home/arpepper/dovecotdovecot9/passwdext arpepper:x:1002:1002::/home/arpepper:/bin/bash:userdb_mail=mbox:~/my-mail:INBOX=/var/mail/%u:INDEX=~/.my-dovecot-indexes arpepper@cscfpc20:~$
Timo once claimed to me you could have a userdb return namespaces, but he did not elaborate sufficiently for me work out how. Until that detail is determined, creating custom configurations which mix both maildir and mbox (which would seem to be desirable) would be problematic.
An "rimapd" approach is (almost) possible.
-- AdrianPepper - 15 Mar 2011
-- AdrianPepper - 19 Oct 2012
-- AdrianPepper - 20 Mar 2013