Virtualmin FTP not working on port 21

On CentOS 7 you try to FTP to your freshly installed Virtualmin server by doing this:

user@hostname ~ $ ftp
ftp: connect: No route to host

The message doesn’t make sense because::

  1. There is a route to that host because you can ping it
  2. This is a fresh server. FTP should be working.

It appears that some later versions of CentOS + Virtualmin combo uses FirewallD which doesn’t  accommodate port 21 by default. To fix the problem:

Root to server, and do this:

firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --reload

You could also try doing this using the Virtualmin GUI but if that’s problematic ie. freezing it could be because Root user PID 1 is hogging SystemD.

But using above method means that FTP should work:

user@hostname ~ $ ftp
Connected to
220 FTP Server ready.
Name ( username
331 Password required for username
230 User username logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd public_html


Share this article

1 thought on “Virtualmin FTP not working on port 21”

  1. Hello, it helped me a lot. I could not connect by FTP, but SFTP was working fine. And boom, FTP starts to connect again, as have to. Thank you a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top