Articles in this section

Content cannot be listed via FTP on a Plesk server: 421 Service not available, remote server has closed connection

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • FTP directory listing is not working for the dedicated IP on a Linux Plesk server that is behind NAT. The error that is displayed is similar to the following:

    CONFIG_TEXT: ftp> ls
    421 Service not available, remote server has closed connection
    Passive mode refused.

Cause

ProFTPd's MasqueradeAddress feature is configured on a Plesk server that uses more than one IPv4 address.

MasqueradeAddress instructs the FTP server to provide only the defined IP within the configuration to FTP clients, due to which they attempt to establish a connection only to that specified IP address:

# grep -r Masq /etc/proftpd*
MasqueradeAddress 203.0.113.2

If your server has several IP addresses, this static setting forces all passive connections to use that IP, which is causing the issue.

Resolution

In order to resolve such an issue, it is necessary that you turn off the MasqueradeAddress of ProFTP for the IP address that is affected, which can be done by following these steps:

  1. Connect to the server via SSH
  2. Create a /etc/proftpd.d/49-masquerade-off.conf configuration file:

    # touch /etc/proftpd.d/49-masquerade-off.conf

  3. Edit /etc/proftpd.d/49-masquerade-off.conf with your favorite command-line text editor and add the following content:

    Note: Replace  203.0.113.2 with the server IP address for which it is required to disable the MasqueradeAddress setting.

    CONFIG_TEXT: <VirtualHost 203.0.113.2>
    MasqueradeAddress none
    </VirtualHost> 

  4. Save the changes and close the file
  5. Restart proftpd by executing the following command:

    # systemctl restart proftpd

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.