Report this

What is the reason for this report?

Cannot connect via FTP

Posted on April 17, 2020

Hi, I having a problem connect via FTP, Error said

Status: Connecting to 178.128.101.122 178.128.101.122… Response: fzSftp started, protocol_version=9 Command: open “root@178.128.101.122 178.128.101.122” 22 Error: Could not connect to server

I have been able to connect before. but now I cant. Please help. Thank you.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @tor9togethers,

You’ll need to make sure you have your IP whitelisted on your droplet and your port opened.

To do so, SSH to your droplet

ssh root@YourDropletIP

Then once you are in, open port to 21(FTP)

iptables -A INPUT -i eth0 -p tcp -m tcp --dport 21 -j ACCEPT

The above will allow the port for everyone. If you want to allow it only for your IP, run the following

iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX --sport 1024:65535 -d XXX.XXX.XXX.XXX --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s XXX.XXX.XXX.XXX --sport 21 -d XXX.XXX.XXX.XXX --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Please remember to change XXX.XXX.XXX.XXX with your actual IP address.

Additionally, you might want to allow traffic to your droplet for every port from your IP address, you can achieve this by running the following commands

/sbin/iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp -d  XXX.XXX.XXX.XXX -j ACCEPT

Again, please remember to change XXX.XXX.XXX.XXX to the actual IP address.

Regards, KDSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.