Failure to receive email on step-by-step guide for Postfix
I'm working through the Step-by-step part of the Troubleshooting guide.
On Step 8, checking for email, I get the following error.
fgphil@adonax:/$ mail Cannot open mailbox /var/mail/fgphil: Permission denied No mail for fgphil
Checking the contents of /var/mail:
fgphil@adonax:/$ sudo ls /var/mail [sudo] password for fgphil: root vhosts
Shouldn't there be a folder for "fgphil"?
Here is a more complete list of what I did leading up to this test:
I reinstalled Postfix, after first purging and removing. For "General Type of Mail Configuration" I selected "Internet Site". For "System mail name" I am using "adonax.com".
When inspecting /etc/postfix/main.cf, the following was generated automatically for "mydestination"
mydestination = $myhostname, adonax.com, adonax.adonax.com, localhost.adonax.com, localhost
Thus, nothing to edit or change, yes?
(When first setting up the Linode and not knowing any better, I gave my host the name "adonax" which duplicates the domain.)
For Step 6, I sent an email to "email@example.com". "fgphil" is the name that I'm using to log in with, via ssh. I don't intend to actually have this as an email address. To send the email, I made use of an AOL account that I have.
Did I execute Step 6 in a valid way? Is there a better way? It seems to take several hours before I get a reply that describes being unable to deliver the email.
I have tried taking a look at the ports. From Linode, everything looks good, but from my laptop, I can only ping. Telnet fails to connect on port 25 or any other port listed in the instructions.
I tried installing WinMTR and testing, but I don't understand how to interpret the results. It seems to me that WinMTR is finding my URL just fine and shows 100% success, but no intermediate hops. Is there a way to test ports with MTR? When I enter the url with a port, as in "220.127.116.11:25" and "18.104.22.168 25" I get the following error:
unable to resolve host name
First for step 8, you have a permissions/ownership problem on /var/mail. That's why you got Permission denied.
You don't need localhost.adonax.com unless that is a legal hostname for your system. From your exposition, I concluded that it wasn't… Maybe I'm wrong… You also need to make sure DNS/rDNS is set up correctly for your server name. At a minimum, you'll need an A/AAAA record and an MX record for adonax.com..
If you are going to send/receive mail offsite, you're going to need rDNS set up as well (all the big email domains require this -- comcast.net, gmail.com, etc). If you don't do this, everyone is going to reject connections with you because they'll think you're a spammer.
Did you open the mail ports in your firewall?
Typically, you need ports 25 (smtp), 465 (smtps/submissions), 587 (submission). If you have a local delivery agent (i.e., dovecot), you also need to open 110/995 (pop3/pop3s) or 143/993 (imap/imaps). Which of these you open is going to be determined by the configuration of your LDA.
For email transport & submission, you need all 3 of 25, 465, 587. If you're going to use a remote mail user agent (e.g., Outlook, Thunderbird, etc) you're going to need an LDA and one or more of the LDA ports (I use 995/993…and, because I have programs running as part of the delivery pipeline that do delivery, 143 is open only for localhost).
I don't know what WinMTR is. However, it is (correctly) rejecting 22.214.171.124:25 and 126.96.36.199 25 as valid FQDNs.
Hope this helps.
Thanks for taking the time to answer.
It's hard for me to remember exactly what was happening and how I surmounted the issues I was confronting at this stage. I do have an email server working now, and I regret the extent to which there are multiple questions listed along the way where I did not follow up once finding an answer. I'm currently attempting to find all of them and post follow-ups.
I believe the main error I was making at the time I posted the question here was in not handling the ports correctly. Looking back at the Step-By-Step guide, it seems to me the author(s) were writing with the assumption that if a port is mentioned in the text, the reader would obviously know that these would have to be configured. Alas, being new to this process, it wasn't obvious to me. Nor was it obvious how to diagnose and fix the issue.
The tool UFW, as written about here is most helpful. I can understand the desire to keep the article strictly functional, i.e., focused on "how to". But it would be nice if some section of the article at least mentioned some of the "why", e.g., the most common port settings, alerting the novice about what to expect and look for.
I have a lot on my plate, but am hoping at some point to propose are add some background or disambiguating info to the mostly very helpful guides provided by Linode.