# [NVM:P]mailnewb: postfix, virtual mailhost permission errors

## Stonic

Hello,

I have just attempted to install a virtual mailserver using the guide @ http://www.gentoo.org/doc/en/virt-mail-howto.xml.

I am having a hard time understanding how the whole thing is supposed to work, and the differences between a local and virtual mailserver. My problem is this:

Whilst trying to work with a virtual domain host - I have permission errors either logging in, or receiving mail (depending on maildir ownership). I have set up an email account "administrator@martialroofing.com" and I am using mysql to store aliases/domains/users.

In mysql I have the following:

 *Quote:*   

> id	email 	clear 	name	uid	gid	homedir	maildir
> 
> 1	administrator@martialroofing.com	PASSWORD	System Administrator	1004	1004	/home/vmail/martialroofing.com/administrator	/home/vmail/martialroofing.com/administrator/.maildir/

 

the uid/gid for the user "administrator" is 1004, the vmail uid/gid is 1005.

When I chown -R vmail:vmail /home/vmail/martialroofing.com/administrator/.maildir I can not login to my account via thunderbird. So I: chown -R administrator:administrator /home/vmail/martialroofing.com/administrator/.maildir and am then able to log in.

However, if I try sending a mail to administrator@martialroofing.com, I get a permission error as it's trying to use the vmail uid/gid.

 *Quote:*   

> Mar  9 13:15:03 gentoo1 postfix/virtual[12943]: warning: maildir access problem for UID/GID=1005/1005: create maildir file ///home/vmail/martialroofing.com/administrator/.maildir/tmp/1299701703.P12943.gentoo1.comfynet.com: Permission denied
> 
> Mar  9 13:15:03 gentoo1 postfix/virtual[12943]: warning: perhaps you need to create the maildirs in advance

 

I can change ownership to vmail again, and am able to send mail to that account. My "local" domain setup (vxservers.com) works both ways, using the local uid/gid.

So my question is, can virtual mail hosts use local accounts for both auth + mail functions? I probably have misconfigured something, so I'll post some configurations:

```
MYSQL

====

[u]transport table[/u]

id domain destination

2 martialroofing.com virtual:

[u]users table[/u]

2   administrator@martialroofing.com   $PASSWD   "System Administrator"   1004   1004   /home/vmail/martialroofing.com/administrator   /home/vmail/martialroofing.com/administrator/.maildir

(I also tried changing the 1004 uid/gid to 1005 that of vmail, same result)

my 'virtual' table is empty <-- could this be why? lol
```

/etc/postfix/main.cf

```
home_mailbox = .maildir/

#user-defined params

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes

smtpd_sasl_local_domain =

smtpd_recipient_restrictions =

  permit_sasl_authenticated,

  permit_mynetworks,

  reject_unauth_destination

smtp_use_tls = yes

smtp_tls_note_starttls_offer = yes

smtpd_use_tls = yes

#smtpd_tls_auth_only = yes

smtpd_tls_key_file = /etc/postfix/newkey.pem

smtpd_tls_cert_file = /etc/postfix/newcert.pem

smtpd_tls_CAfile = /etc/postfix/cacert.pem

smtpd_tls_loglevel = 3

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

tls_random_source = dev:/dev/urandom

local_transport = local

local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname

virtual_transport = virtual

virtual_mailbox_domains = martialroofing.com

virtual_minimum_uid = 1000

virtual_gid_maps = static:1005 #vmail gid

virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf

virtual_uid_maps = static:1005 #vmail uid

virtual_mailbox_base = /

#virtual_mailbox_limit =
```

I'm sure it's something simple, but I can't for the life of me get it to work.Last edited by Stonic on Wed Mar 09, 2011 10:12 pm; edited 1 time in total

----------

## Stonic

*sigh* another sleepless night has depleted the brain.

I figured it out by reading my own post. I guess I didn't try the uid/gid of vmail in the database when I last tested, and assumed incorrectly. By changing the id's in the DB, and using vmail uid/id owenership - everything works. Silly me.

----------

