FTP error code 4xx indicates that the connection was not attempted and that the requested action did not occur. However, this is a temporary condition, and the action may be requested again.
Additionally, the FTP error 421 service not available indicates that the connection to the remote server is unavailable.
FTP Error 421 Service Not Available
Now, let’s discuss the most frequently occurring causes of this error and how our server management team resolve them.
- Invalid FTP host
This error can occur when the FTP server is unable to determine the server’s IP address from the hostname. Additionally, this error is recorded in the server logs (/var/log/messages).
getaddrinfo 'Hostname_Is_Here' error: Name or service not known warning: unable to determine IP address of 'host.domain.com domain
How to fix it?
The ping command is used to determine the FTP host’s connectivity.
ping host.domain.com
If ping doesn’t work, add the correct hostname in the server configuration files.
/etc/hosts
/etc/sysconfig/network
Important: Restart the network service to take effect.
/etc/init.d/network
On Plesk servers, the hostname is changed via Tools & Settings > Server Settings.
2. Restrictions on firewalls
Another possibility for this error is that the firewall configurations or restrictions are incorrect.
We’ve seen instances where the remote server refuses to accept connections from a particular IP address or range of IP addresses. The IP address may be blocked for a variety of reasons, including abnormal activity, excessive connections, and so on.
Similarly, another possibility is that the user’s outbound connections are being blocked at the ISP or at their local firewall. We’ve seen instances where a third-party firewall or antivirus is blocking FTP connections on the system. Additionally, ISPs can block outbound FTP traffic.
How to fix it?
Determine whether the customer’s IP address xx.xx.xx.xx is blocked using the following command.
csf -g xx.xx.xx.xx
Additionally, if the IP address is blocked, we will immediately unblock it and restore FTP access. Later, we notify the customer of the reason for the block and the remedial measures.
If there are no server-side issues, we notify customers and instruct them to gradually disable their security applications such as antivirus, Windows firewall, and so on. This assists us in determining which application is causing issues.
Alternatively, if the issue is at the ISP’s end, we obtain the customer’s traceroute results. This enables us to determine whether the issue is on the intermediate level.
Most importantly, if customers are blocked at the ISP or local firewall level, we always recommend that they connect via SFTP, which uses SSH.
3. Errors in FTP service configuration
Another variant of this error in ProFTP servers is shown below.
test.com proftpd[130008] 127.0.0.1: Failed binding to ::, port 21: Address already in use
test.com proftpd[130008] 127.0.0.1: Check to see if inetd/xinetd, or another proftpd instance, is already using ::, port 21
Typically, this error occurs when another application is already using port 21. This can also occur if the server’s ProFTP service becomes stuck. Similarly, problems can arise due to errors in the FTP service configuration file.
How to fix it?
Using the netstat command, determine which services are listening on FTP port 21.
netstat -plnt | grep :21
And, if we discover that this port is being used by multiple applications or another instance of proftpd, we will reroute these applications to alternate ports. For example, we always make sure that the ServerType parameter in the ProFTP configuration file is set to inetd on Plesk servers.
ServerType inetd
The inetd/xinetd service listens on port 21 for connection requests and then starts proftpd and terminates the connection.
If the FTP service becomes unresponsive on the server, we can use the following commands to terminate the dead process and restart the service.
ps aux | grep proftpd
kill -9 PID
service xinetd restart
Besides that, we check to see if the FTP configuration files (/etc/proftpd.conf and /etc/vsftpd.conf) are intact.
Can’t connect to FTP?
Check that the ProFTPd configuration file (/etc/proftpd.conf) refers to this directory. If the server did not create the folder. To resolve the issue, create a folder /var/run/proftpd/.
Conclution
FTP error 421 service not available can occur as a result of firewall restrictions, an invalid FTP host, and other factors.
If you require an expert to assist you in resolving your ongoing FTP issues? Our technical experts are available 24×7.