Guest User

Untitled

a guest
Apr 13th, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. groupadd -g 5000 vmail
  2. useradd -g vmail -u 5000 vmail
  3. mkdir -p /var/mail/vhosts/example.com
  4. mkdir -p /var/mail/vhosts/example2.com
  5. chown vmail:vmail /var/mail/vhosts/example.com
  6. chown vmail:vmail /var/mail/vhosts/example2.com
  7.  
  8. /etc/postfix/main.cf:
  9. virtual_mailbox_domains = example.com, example2.com
  10. virtual_mailbox_base = /var/mail/vhosts
  11. virtual_mailbox_maps = hash:/etc/postfix/vmailbox
  12. virtual_minimum_uid = 100
  13. virtual_uid_maps = static:5000
  14. virtual_gid_maps = static:5000
  15. virtual_alias_maps = hash:/etc/postfix/virtual
  16.  
  17. /etc/postfix/vmailbox:
  18. info@example.com example.com/info/
  19. sales@example.com example2.com/sales/
  20. info@example2.com example2.com/info/
  21. sales@example2.com example2.com/sales/
  22. # Comment out the entry below to implement a catch-all.
  23. # @example.com example.com/catchall/
  24.  
  25. /etc/postfix/virtual:
  26. # to direct virtual account traffic to a real system account
  27. postmaster@example.com postmaster
  28.  
  29. /etc/courier/authdaemonrc
  30. authmodulelist="authuserdb authpam"
  31.  
  32. postmap /etc/vmailbox
  33. postmap /etc/virtual
  34. /etc/init.d/postfix restart
  35. /etc/init.d/courier-authdaemon restart
  36. echo "First Post" | mail -s "Welcome" info@example.com
  37. echo "First Post" | mail -s "Welcome" sales@example.com
  38. echo "First Post" | mail -s "Welcome" info@example2.com
  39. echo "First Post" | mail -s "Welcome" sales@example2.com
  40. userdb "info@example.com" set uid=vmail gid=vmail home=/var/mail/vhosts/example.com/info mail=/var/mail/vhosts/example.com/info
  41. userdbpw | userdb "info@example.com" set systempw
  42. userdb "sales@example.com" set uid=vmail gid=vmail home=/var/mail/vhosts/example.com/sales mail=/var/mail/vhosts/example.com/sales
  43. userdbpw | userdb "sales@example.com" set systempw
  44. userdb "info@example2.com" set uid=vmail gid=vmail home=/var/mail/vhosts/example2.com/info mail=/var/mail/vhosts/example2.com/info
  45. userdbpw | userdb "info@example.com" set systempw
  46. userdb "sales@example2.com" set uid=vmail gid=vmail home=/var/mail/vhosts/example2.com/sales mail=/var/mail/vhosts/example2.com/sales
  47. userdbpw | userdb "sales@example.com" set systempw
  48. makeuserdb
  49.  
  50. # For some reason this setup may have problems with IMAP
Add Comment
Please, Sign In to add comment