View Full Version : Setup mailaccount
mike
19th April 2005, 17:23
Hi,
I have followed the SuSE 9.2 server "The Perfect Setup".
Now how do I create a mailaccount using courier imap?
Michael
falko
19th April 2005, 17:27
First you have to tell Postfix to deliver emails to a user's Maildir:
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart
Then you have to create a system user and a password:
useradd -d /home/sample_user -g users sample_user
passwd sample_user
Then run
postconf -e 'virtual_maps = hash:/etc/postfix/virtusertable'
postconf -e 'mydestination = /etc/postfix/local-host-names'
/etc/postfix/local-host-names should contain all domains that you want to accept emails for, e.g.:
localhost
your.server.name
localhost.your.server.name
example.com
yourdomain.com
/etc/postfix/virtusertable looks like this:
info@yourdomain.com sample_user
thomas@example.com sample_user
webmaster@yourdomain.com sample_user
Emails for info@yourdomain.com, thomas@example.com and webmaster@yourdomain.com will now arrive in the mailbox of sample_user.
Everytime you change /etc/postfix/virtusertable you have to run the following command:
postmap /etc/postfix/virtusertable
Now restart Postfix:
/etc/init.d/postfix restart
and you're done! :)
mike
20th April 2005, 12:08
Thanks Falko! It is working... :)
Michael
johnnynine
20th August 2007, 23:17
What's the difference between using /etc/postfix/virtusertable and /etc/aliases?
falko
21st August 2007, 18:37
/etc/aliases maps the mails for existing system users to another system user. virtusertable defines the email addresses that belong to a system user.
johnnynine
21st August 2007, 20:09
/etc/aliases maps the mails for existing system users to another system user. virtusertable defines the email addresses that belong to a system user.
I have my /etc/aliases file mapping non-existing system users to a system user and it works fine, so I don't quite understand?
Happy
23rd August 2007, 19:13
etc/postfix/local-host-names
the above file contains no info and when I try and open it says new file. So do I create files that do not exist. as I ran the command prior to the above. I used webmin to add users. Again I am using just local or system users no virtual users
Thanks
Happy
falko
24th August 2007, 23:12
etc/postfix/local-host-names
the above file contains no info and when I try and open it says new file. So do I create files that do not exist.
Yes, you must create that file.
johnnynine
25th August 2007, 09:32
/etc/aliases maps the mails for existing system users to another system user. virtusertable defines the email addresses that belong to a system user.
Ok, I reread this and it makes sense... too many late night linux installs.
Happy
28th August 2007, 05:19
info@yourdomain.com sample_user
thomas@example.com sample_user
webmaster@yourdomain.com sample_user
Since my users are accepting mail for only one domain-WOuld it look like this
thomas@example.com jthomas
thad@example.com sthad
thompson@example.com jthompson
So what I am saying is if I have only one domain and the user is accepting mail for that single domain, does each user need to be put in like above?
Thanks
Happy
falko
28th August 2007, 20:32
Since my users are accepting mail for only one domain-WOuld it look like this
thomas@example.com jthomas
thad@example.com sthad
thompson@example.com jthompson
Yes, that's right. :)
Happy
29th August 2007, 04:04
I am trying to create the folloing file
vi /etc/postfix/local-host-names
localhost
your.server.name
localhost.your.server.name
your.domain
after entering the info above
I go to write the info and get the following error
"etc/postfix/local-host-names"
"etc/postfix/local-host-names" E212: Can't open file for writing
Hit ENTER or type command to continue
Get a 127 Shell error as well
Any ideas on why I can not create this file
Thanks
Happy
falko
29th August 2007, 20:05
Make sure you use /etc/postfix/local-host-names and not etc/postfix/local-host-names.
Happy
30th August 2007, 00:05
Make sure you use /etc/postfix/local-host-names and not etc/postfix/local-host-names.
The . was the problem-not sure how it got in there
Thanks
Happy
Happy
30th August 2007, 00:36
First you have to tell Postfix to deliver emails to a user's Maildir:
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart
Then you have to create a system user and a password:
useradd -d /home/sample_user -g users sample_user
passwd sample_user
Then run
postconf -e 'virtual_maps = hash:/etc/postfix/virtusertable'
postconf -e 'mydestination = /etc/postfix/local-host-names'
/etc/postfix/local-host-names should contain all domains that you want to accept emails for, e.g.:
localhost
your.server.name
localhost.your.server.name
example.com
yourdomain.com
/etc/postfix/virtusertable looks like this:
info@yourdomain.com sample_user
thomas@example.com sample_user
webmaster@yourdomain.com sample_user
Emails for info@yourdomain.com, thomas@example.com and webmaster@yourdomain.com will now arrive in the mailbox of sample_user.
Everytime you change /etc/postfix/virtusertable you have to run the following command:
postmap /etc/postfix/virtusertable
Now restart Postfix:
/etc/init.d/postfix restart
and you're done! :)
Ok I orginally created the users mailboxes in webmin
and then created them in
/etc/postfix/virtusertable
when I ran /etc/init.d/postfix restart
I got a error/warning saying duplicate -
however the users remained in
/etc/postfix/virtusertable
Should I expect any issue
If not then I will begin testing as I am done except for doing some Spam catching/filtering
Happy
falko
30th August 2007, 22:54
What's the exact error message? What's in /etc/postfix/main.cf?
Happy
31st August 2007, 04:58
Again the users were created in webmin
Here is the error message I got
root@mail:~# postmap /etc/postfix/virtusertable
postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: "sample.net"
postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: "sample.net"
postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: "sample.net"
is this not needed since I created the users in webmin or should I delete all users out of webmin and then create them manually?
I got the above waring/error when I added another user (I created the user in webmin first) and then added to the virtusertable
The following file exist but nothing is in it
/etc/postfix/main.cf
Thanks
Happy
falko
1st September 2007, 21:41
What's in /etc/postfix/virtusertable? What's the output of cat /etc/postfix/main.cf?
Happy
2nd September 2007, 01:53
What's in /etc/postfix/virtusertable?
all my users email addresses are in the file
sample.com jsmith
What's the output of cat /etc/postfix/main.cf?
root@mail:~# vi /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mail.sample.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = /etc/postfix/local-host-names
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject _unauth_destination
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
home_mailbox = Maildir/
virtual_maps = hash:/etc/postfix/virtusertable
Happy
falko
2nd September 2007, 21:12
Do you have duplicates in /etc/postfix/virtusertable?
Happy
3rd September 2007, 04:25
Do you have duplicates in /etc/postfix/virtusertable?
There are no duplicates in the virtusertable. However, I entered them in webmin first so I am not sure why I got the warning
falko
3rd September 2007, 22:38
I think the problem is that you use Webmin AND configure email addresses manually. Webmin has a different way to set up email addresses in Postfix than the method described here.
Happy
3rd September 2007, 22:58
So do I need to remove all users from the virtualuserstable or leave it as is?
falko
4th September 2007, 20:41
I don't know what Webmin has done, so I think it's best to reinstall the system and then opt for just one way of managing your system (either by hand or with a control panel like Webmin).
Happy
8th September 2007, 21:01
I just removed all users from virtualuserstable via webmin (no more duplicate warnings)and all is good, the mail server is up and running like a champ now. I want to thankyou for all your help. Another question ? I want to diasble root from telnet and also from acessing via webmin (https). I know I can turn root account to //bin/false to prevent this account from logging in via SSH on port 22. Now I need to figure out how to disable it in webmin (so it can not ;log in via the web interface). To me this is an open door as I have created another account that I use to administer the mail server with-any help would be great
Thanks
Happy
v2k
14th September 2007, 03:49
Is it necessary to create the user:
useradd -d /home/sample_user -g users sample_user
passwd sample_user
I skipped that step, and tried to use an already existing user?
No matter who I send mail to, mail returns no mail.
thanks,
Vince.
Happy
14th September 2007, 04:04
I would just use webmin to admin users add/remove/reset passwords check their mailbox etc
If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the line : deb http://download.webmin.com/download/repository sarge contrib You will now be able to install with the commands : apt-get update
apt-get install webmin All dependencies should be resolved automatically.
:o
v2k
14th September 2007, 04:34
Sounds scary. I've been doing everything manually so far, so I might as well keep it that way.
falko
14th September 2007, 19:30
Is it necessary to create the user:
useradd -d /home/sample_user -g users sample_user
passwd sample_user
I skipped that step, and tried to use an already existing user?No, you don'T have to do that if the user's already existing.
No matter who I send mail to, mail returns no mail.
Any errors in your mail log?
v2k
14th September 2007, 21:41
right, I had a domain error in postconf, but that didn't fix it:
I ran some DNS tests on the mail server, and it seems to pass all the standard mail tests.
(i replaced my actual domain with MYDOMAIN)
Sep 14 11:30:41 MYDOMAIN sendmail[27225]: l8EIUfT1027225: from=root, size=41, class=0, nrcpts=1, msgid=<200709141830.l8EIUfT1027225@MYDOMAIN.com>, relay=root@localhost
Sep 14 11:30:41 MYDOMAIN postfix/smtpd[27226]: connect from localhost.localdomain[127.0.0.1]
Sep 14 11:30:41 MYDOMAIN postfix/smtpd[27226]: setting up TLS connection from localhost.localdomain[127.0.0.1]
Sep 14 11:30:41 MYDOMAIN postfix/smtpd[27226]: TLS connection established from localhost.localdomain[127.0.0.1]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Sep 14 11:30:41 MYDOMAIN sendmail[27225]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Sep 14 11:30:41 MYDOMAIN postfix/smtpd[27226]: 7E3EA31B02E3: client=localhost.localdomain[127.0.0.1], sasl_sender=root@MYDOMAIN.com
Sep 14 11:30:41 MYDOMAIN postfix/cleanup[27229]: 7E3EA31B02E3: message-id=<200709141830.l8EIUfT1027225@MYDOMAIN.com>
Sep 14 11:30:41 MYDOMAIN postfix/qmgr[28376]: 7E3EA31B02E3: from=<root@MYDOMAIN.com>, size=609, nrcpt=1 (queue active)
Sep 14 11:30:41 MYDOMAIN sendmail[27225]: l8EIUfT1027225: to=v2k@MYDOMAIN.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30041, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 7E3EA31B02E3)
Sep 14 11:30:41 MYDOMAIN postfix/local[27230]: 7E3EA31B02E3: to=<v2k@MYDOMAIN.com>, relay=local, delay=0.43, delays=0.2/0.01/0/0.23, dsn=2.0.0, status=sent (delivered to maildir)
Sep 14 11:30:41 MYDOMAIN postfix/qmgr[28376]: 7E3EA31B02E3: removed
Sep 14 11:30:42 MYDOMAIN postfix/smtpd[27226]: disconnect from localhost.localdomain[127.0.0.1]
Note, there are files in Maildir/new, but "mail" says I have no mail.
v2k
14th September 2007, 21:44
Upon inspection, these files do contain my actual mail. So it's just that mail thinks I have none....
pop3 works, so I guess it's not a big deal.
falko
15th September 2007, 17:13
What POP3 server do you use? What's the output of netstat -tap? You must use a POP3 daemon that uses Maildir.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.