I installed vsftpd in my Linux Server 12.04. Unfortunately my firewall closed port 20 and 21. So I used the commands found here and other commands to open my ports. But I tested with nmap and I saw ports didn't open.

What can I do? I need to open these ports.

  • What firewall are you using?
    – saji89
    Aug 8, 2012 at 10:59
  • What firewall software are you using?
    – Mitch
    Aug 8, 2012 at 11:00
  • My firewall is iptables
    – Peyman
    Aug 8, 2012 at 11:06
  • 2
    Try ufw allow in ftp
    – user77111
    Aug 8, 2012 at 12:18
  • Some ISPs block ports 20 and 21, did you make sure your ISP allows them?
    – Thomas Ward
    Aug 8, 2012 at 16:54

3 Answers 3


Sometimes a port will need to be forwarded from the router (take a look at port forwarding), or perhaps port 21 is already pointing to something else on the network?


On the website there was these 2 lines

iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 20 -j ACCEPT

After that you may need to restore your iptables rules with:

  • Thank you but dosn't work. terminal sey to me:: -A: command not found
    – Peyman
    Aug 8, 2012 at 12:14
  • Instead of -A please try it with -I
    – j0N45
    Aug 8, 2012 at 12:16
  • 1
    Dosn't work. but I can solved my problem, I wrote 'iptables -F' in terminal and 'Listen 21' in /etc/apache2/ports.conf and then restart apache. Thank you
    – Peyman
    Aug 9, 2012 at 9:24
  • Make sure your ISP allows you to use those ports, there are ISPs that will block those ports automatically.
    – Thomas Ward
    Mar 2, 2013 at 20:37

Same issue, installing ftpd in ubuntu 18.04.

A telnet on port 21 is blocking (local network).

Apply the following command as root

ufw allow in ftp

and the port is opened.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .