How to solve an issue with FTP after changing server IP

Hi Everyone!

I just stumbled upon a small issue related to FTP and I would like to share the fix.

TL;DR;
If you ever change your server’s IP, you also have to change it in /etc/cyberpanel/machineIP AND in /etc/pure-ftpd/conf/ForcePassiveIP, otherwise FTP will not work properly.

For me, it’s a pretty common operation to restore snapshotted servers and/or change its public IP for various reasons (transfering, changing, capacity, starting a new from a previous snapshot, etc).

Yesterday I did this operation to better organize a server that I have in a local cloud provider. I wasn’t being able to grow the system partition for some reason (the VPS always became unbootable) so I decided to build a new server from scratch and allocate a secondary volume for the /home. After doing everything, syncing content and etc, I swapped the IPs.

Today one of my customers wasn’t able to connect to the FTP. I checked incoming passive ports, firewall, everything was just fine. Until I remembered about the IP swapping and boom. Checking the connection log the server was trying to pass the old IP (which was quite similar, so it didn’t catch my eye at first). Updated /etc/pure-ftpd/conf/ForcePassiveIP with the right IP, issued a systemctl restart pure-ftpd-mysql to restar the FTP daemon and everything got back working.

So, besides following this article (https://cyberpanel.net/docs/fix-ftp-over-tls-errors-on-ubuntu-in-cyberpanel/), also check if your FTP daemon is aware of the right IP to be used.

The error you may see will be a ‘Failed to retrieve directory listing’.

2 Likes

Thx for the tips ! Your tutorial works for me !

Thanks a lot man! It was on top of my mistake, that’s what I needed!

IP Changed successfully but im getting a wierd error after i found out my IP was wrong.


Any suggestions?