In FTP servers, there are two modes for data transfer: active and passive. In active mode, the server itself initiates the data transfer, whereas in passive mode, the client requests an open port on the server to establish and start the data transfer. Connecting to an FTP in passive mode can solve connection issues if there is a firewall on the client side.
To configure Plesk's FTP in passive mode, we need to connect via SSH to our server using the "root" user.
We check if the following file exists: "55-passive-ports.conf":
# ls -l /etc/proftpd.d/
If it does not exist, we create the file:
# vi /etc/proftpd.d/55-passive-ports.conf
Add the following content:
<Global>
PassivePorts 49152 65535
</Global>
If the file exists, we verify that the content is correct with the following command:
# cat /etc/proftpd.d/55-passive-ports.conf
Restart the service:
# systemctl restart xinetd
Add rules to the Plesk Firewall
Information
If you do not have the Plesk Firewall installed, you can skip this step.
If the Plesk Firewall is enabled, we need to ensure that ports49152 to 65535 are open for inbound traffic. If they are not open by default, follow these steps:
Go to "Tools & Settings > Firewall".
Click on the "+" button to add a new custom rule.
In the next form, fill in the rule name ("New custom rule"), select "Incoming" traffic, choose "Allow" as the action, and add the port range "49152-65535" in "Add port range". Leaving "Sources" blank applies the rule to all IPs. You can restrict it to specific IP ranges if needed. Finally, click "Save" to create the rule.
To apply the rule, click "Apply Changes".
Confirm by clicking "Apply".
After completing these steps, you will see the created rule in the Firewall rules list.
Adding rules to the Clouding Firewall
To allow your server to accept traffic on passive FTP ports in Plesk, you must open ports 49152 to 65535 in the Firewall linked to your server.
Access your Clouding Customer Panel, then go to "My Firewalls", and edit the "default" firewall by clicking the pencil icon:
Click the "+" icon to add a new rule.
Click "+" at "Add new firewall rules" to add a custom rule.
Configure the new rule with the "TCP" protocol, from port 49152 to port 65535, and set the source IP to 0.0.0.0/0 to allow connections from any IP address.
After these steps, your server will be ready to accept passive FTP connections configured earlier in Plesk from the client panel.
Connect to FTP in passive mode using Filezilla
Open the Filezilla FTP client and open the "Site Manager":
Click "New Site".
On the left, set an identifiable name for the connection. On the right, enter the IP address or domain configured in Plesk. If you have not set up an SSL certificate to allow secure connections, select "Only use plain FTP (insecure)" as the encryption method.
Finally, go to the "Transfer Settings" tab, select "Passive" mode, and click "Connect". You will be prompted for your FTP username and password, and you will then be connected to perform transfers in passive mode.
Connect to FTP in passive mode from Ubuntu Server
To connect via FTP in passive mode from the command line of an Ubuntu Server, execute the following command:
ftp -d localhost
Connected to localhost.localdomain.
220 ProFTPD Server (ProFTPD) [::1]
ftp: setsockopt: Bad file descriptor
Name (localhost:root): ftpadmin
---> USER ftpadmin
331 Password required for ftpadmin
Password:
---> PASS XXXX
230 User ftpadmin logged in
---> SYST
215 UNIX Type: L8
Remote system type is UNIX.
Using binary mode to transfer files.
Now we need to enable passive mode:
ftp> passive
Passive mode on.
We list the contents of the root directory of our FTP connection:
ftp> ls
---> EPSV 2
229 Entering Extended Passive Mode (|||50042|)
---> LIST
150 Opening BINARY mode data connection for file list
drwxr-xr-x 2 ftpadmin psacln 4096 Jun 30 14:32 error_docs
drwxr-x--- 2 ftpadmin psaserv 4096 Jun 30 14:32 httpdocs
drwx------ 2 ftpadmin root 4096 Jul 1 06:26 logs
226 Transfer complete
If you have any questions about configuring your cloud server or any other matter, write to us at soporte@clouding.io. Our Technical Support team will be happy to assist you with anything you need.