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 cp01.vander.host
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 servername.com
Connected to host.domain.com.
220 FTP Server ready.
Name (servername.com): username
331 Password required for username
Password:
230 User username logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd public_html

References:
https://virtualmin.com/node/59372
https://www.liquidweb.com/kb/how-to-start-and-enable-firewalld-on-centos-7/

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