0

I've bought an unmanaged dedicated server. Mainly to help me learn.

My email isn't working and the host support have told me I that need to open port 25 to enable smtp. Note I can't send or receive email.

I've used SSH to login and I've tried a few of the sample snippets of code from this forum but I just get a command not found back.

My server is running centOS and it has a Plesk GUI.

I've connected to the server using ssh root@myipaddress

10
  • There are few questions to be asked here: How is your email not working ? What did you try and see failing ? Could you please explain ? Also, from another server on the internet, please run this command telnet your_ip_address 25 and update your original post with the output you see on the terminal window. Commented Jun 16, 2016 at 15:57
  • Thanks! I just can't send or receive email. It just won't connect to the server. I have just used that telnet command and I have received back "Unable to connect to remote host" Commented Jun 17, 2016 at 10:10
  • On the local host, i.e. your new centos system, please run this command and post the output: netstat -an | grep 25 this will show you if anything is listening on the smtp port, i.e. port 25, on your server. If it is not, this means you can not receive email on this server. Commented Jun 17, 2016 at 13:19
  • I get the following: See code here Commented Jun 17, 2016 at 19:00
  • You don't have anything listening on port 25, which is SMTP port. So, there is no way that someone can send an email to your server and you receive it. Answer below, assumes that you have a running mailserver and trying to help you let the SMTP traffic pass through the iptables server based firewall. But you are not at that stage yet. You need to configure a mail server. Unless your sole purpose it to send and receive email with this server, it is not a good start point, learning about Linux. A badly configured mail server can be a honey pot for spammers and you find yourself in hot water Commented Jun 17, 2016 at 19:25

1 Answer 1

0

The command to check if 25 is open:

Telnet <your-IP> 25

If it allows it, the port is open and that's not your problem.

If connection is refused, do the following:

sudo vi /etc/iptables.test.rules

Check that there is an entry like this:

# Allows SMTP access -A INPUT -p tcp --dport 25 -j ACCEPT

If not, change it using vi commands. If you're new, remember i goes into insert mode to use standard keyboard and :wq! saves when you're done.

Next, apply the rules you just wrote.

sudo iptables-restore < /etc/iptables.test.rules

Check to make sure the rules are applied correctly.

sudo iptables -L

Next, save them permanently.

sudo iptables-save > /etc/iptables.up.rules

7
  • Thank you so much for helping me. When I use the iptables.test.rules command I get no entry and just the prompt "/etc/iptables.test.rules" [New File] Commented Jun 17, 2016 at 10:12
  • Do I need to create this file and set up the ports I want open? Commented Jun 17, 2016 at 10:13
  • Run this command and let me know what you get: netstat -a | grep 25 This will look for all ports then filter out just the lines that include "25" Commented Jun 17, 2016 at 14:11
  • I get the following: See code here Commented Jun 17, 2016 at 18:58
  • Doesn't look like anything is trying o connect creating a binding. Try nc -l 25 then from a remote computer either ssh to port 25 or nc <local $hostname> 25 Commented Jun 20, 2016 at 15:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.