[Dovecot] UID confusion

mouss mlist.only at free.fr
Sun May 27 16:01:27 EEST 2007


Kevin wrote:
> I have just finished reading the info on the wiki on setting up 
> virtual users with Dovecot and Postfix. 
> http://wiki.dovecot.org/DovecotLDAPostfixAdminMySQL
>
> I'm confused about the UID and GID's. In the docs it shows a user, 
> vmail being created with a UID of 101. Then it looks like GID 12 is 
> used for Postfix or Mail.

101 and 12 are just numbers. The fact that they are different shows that 
they can be different (and unless you enforce the numbers when creating 
the user and group, they will generally be different). There are 
generally more users than groups, so a new gid is generally lower than a 
new uid.

If your mailstore belongs to foo:bar (you did a 'chown foo:bar 
/path/to/mailtostore'), then set the uid to the uid of foo, and the gid 
to the gid of bar. the uid is found in /etc/passwd, the gid is found in 
/etc/group.

uid=`grep "^foo" /etc/passwd |awk -F: '{print $3}'`
gid=`grep "^bar" /etc/group |awk -F: '{print $3}'` 

a common setup is to use vmail:vmail as user:group (sometimes with 
uid=gid), but this doesn't change the above (the vmail use and the vmail 
group are two different beasts, because a user and a group are different 
concepts).

the choice of the group is dictated by access permissions that other 
programs (backup, retrain a spam filter, ....) need. It is recommended 
to make sure no other user (real or program) can access the mailstore 
unless it is really necessary, and if so, make sure this access cannot 
be subverted.



More information about the dovecot mailing list