[Dovecot] Maildir/mbox on a per-user basis
Hello,
The Wiki indicates that Dovecot can do either mbox or Maildir on a per-user basis:
default_mail_env can be overridden in userdb for each user. This works with userdbs supporting the "mail" attribute (eg. passwd-file, SQL, LDAP).
How exactly does one do this for passwd-file?
Thanks,
-Jon
-- Jon Nathan jon@rupture.net
On 20.11.2004, at 00:15, Jon Nathan wrote:
default_mail_env can be overridden in userdb for each user. This works with userdbs supporting the "mail" attribute (eg. passwd-file, SQL, LDAP).
How exactly does one do this for passwd-file?
user:password:uid:gid:(gecos):home:(shell):flags:mail
It's the mail part there.
- Timo Sirainen tss@iki.fi [11-28-2004 22:05]:
On 20.11.2004, at 00:15, Jon Nathan wrote:
default_mail_env can be overridden in userdb for each user. This works with userdbs supporting the "mail" attribute (eg. passwd-file, SQL, LDAP).
How exactly does one do this for passwd-file?
user:password:uid:gid:(gecos):home:(shell):flags:mail
It's the mail part there.
Thanks for your help, Timo. I now have this working. In case this is helpful to anyone, the below script generates a passwd-file from the system passwd/shadow file (this was on Solaris). It defaults users to mbox, but assigns them to Maildir if their name is in a file of maildir users. Fairly simplistic, but it does the job for me.
#!/usr/bin/perl # generates a passwd-file format file for dovecot imapd. # this allows users to choose either maildir or mbox # defaults to mbox; maildir users go into $maildirusers
# passwd-file format: # user:password:uid:gid:(gecos):home:(shell):flags:mail
# files $syspass="/etc/passwd"; $sysshad="/etc/shadow"; $dovecotpass="/usr/local/etc/dovecot.passwd"; $maildirusers="/usr/local/etc/dovecot.maildirusers"; umask 0077;
if(-f $dovecotpass){ system("rm $dovecotpass"); # start fresh }
open(SYSPASS,"<$syspass")||die("Can't open system passwd file $!\n"); while(<SYSPASS>){ chomp($_); $syspassline=$_; ($user,$pass,$uid,$gid,$gecos,$home,$shell) = split(/:/,$syspassline);
if($uid>100){ # don't run on system accounts
$sysshadline=grep '^$user:' $sysshad
;
($shaduser,$shadpass)=split(/:/,$sysshadline,3);
$maildiruser=`grep '^$user\$' $maildirusers`;
$flags=""; # for passwd-file format
open(OUT,">>$dovecotpass");
if($maildiruser){
$mailbox="maildir:/home/$user/Maildir";
}else{
$mailbox="mbox:~/mail/:INBOX=/home/$user/mail/inbox";
}
print OUT "$user:$shadpass:$uid:$gid:$gecos:$home:$shell:$flags:$mailbox\n";
close(OUT);
} } close(SYSPASS);
#FIN
-Jon
-- Jon Nathan jon@rupture.net
Some of the users have personal preferences. We default to mbox, but some people would rather use Maildir. They take care of delivery to the Maildirs on their own (with procmail recipes) and take advantage of certain features (subfolders).
-Jon
-- Jon Nathan jon@rupture.net
- Sean Porter dovecot@seanporter.com [11-29-2004 23:33]:
On Nov 29, 2004, at 3:47 PM, Jon Nathan wrote:
Thanks for your help, Timo. I now have this working.
Just out of curiosity, why would you want to use both formats for storage?
On Tue, Nov 30, 2004 at 02:41:02PM -0500, the unit calling itself Jon Nathan wrote:
<re-structured for clarity>
Just out of curiosity, why would you want to use both formats for storage?
Some of the users have personal preferences. We default to mbox, but some people would rather use Maildir. They take care of delivery to the Maildirs on their own (with procmail recipes) and take advantage of certain features (subfolders).
Isn't maildir format required to support imap clients?
Jay
On Wed, Dec 01, 2004 at 01:44:38PM -0600, J Moore wrote:
On Tue, Nov 30, 2004 at 02:41:02PM -0500, the unit calling itself Jon Nathan wrote:
<re-structured for clarity>
Just out of curiosity, why would you want to use both formats for storage?
Some of the users have personal preferences. We default to mbox, but some people would rather use Maildir. They take care of delivery
Isn't maildir format required to support imap clients?
No.
I think the mbox format is particularly well suited for (mailing list) archives which are kept around in read- mostly form. They may also be a better fit for some legacy mail clients that read mail directly on the server.
- Jim Tittsler jt@OnJapan.net [12-01-2004 18:46]:
I think the mbox format is particularly well suited for (mailing list) archives which are kept around in read- mostly form. They may also be a better fit for some legacy mail clients that read mail directly on the server.
Hey! There are lots of people that use mutt/pine/etc to read mail directly on the server. Usually they are the sysadmins setting up IMAP service for their users 8-)
-Jon
-- Jon Nathan jon@rupture.net
Jon Nathan wrote:
Hey! There are lots of people that use mutt/pine/etc to read mail directly on the server. Usually they are the sysadmins setting up IMAP service for their users 8-)
Mutt reads maildir's just fine and there appears to be at least one patch for pine to do the same.
John
-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
participants (9)
-
J Moore
-
Jim Tittsler
-
John Peacock
-
Jon Nathan
-
Jon Nathan
-
Jon Nathan
-
Jon Nathan
-
Sean Porter
-
Timo Sirainen