Solved FTP/SFTP wont connect from the GUI but works from CLI

AutiCodes

Verified User
Joined
Jun 9, 2024
Messages
39
Hi! So i got an storage share at Hetzner.
Now i can connect to the SFTP from CLI: "sftp -P 22 usernameHereFromHetzner@usernameHereFromHetzner.your-storagebox.de"
But when i try to do the same in the admin backup, im getting an error:
"
/usr/bin/curl returned error code 8
curl: (8) Failed to connect to u422175.your-storagebox.de port 21 after 1202 ms: Connection refused
FTP information invalid.
Close
"

Now i filled in:
IP: usernameHereFromHetzner.your-storagebox.de
Username: usernameHereFromHetzner
Password: the password i used when i used that SFTP CLI command
Remote Path: / (also tried with the storage box name (/backup)
Port: 21 & 22
Secure FTP: Tried on when port 22 and off on port 21
Append: Week of Month

Who can help?
 
Update: When i run the command:
ftp_port=21 ftp_local_file=/usr/local/directadmin/scripts/test.txt ftp_ip=usernameHereFromHetzner.your-storagebox.de ftp_username=usernameHereFromHetzner ftp_password_esc_double_quote=Redacted ftp_path=/ ftp_secure=ftps ./ftp_upload.php

Then i dont get an error. When i litteraly copy-paste the ip, username, password and path in the GUI then it errors out:
"/usr/bin/curl returned error code 8
curl: (8) Failed to connect to usernameHereFromHetzner.your-storagebox.de port 21 after 1218 ms: Connection refused
FTP information invalid.
"
(i did install ncftp)

Edit: So i've looked at it with an friend and it seems that DA is the issue.
For example the CLI command "curl ftp://usernameHere:[email protected]/"
work fine...
 
Last edited:
try disable csf firewall and re-test again in admin backup
 
try disable csf firewall and re-test again in admin backup
Hi, this worked! But what can i change to make it work with CSF on?

1725649160832.png

The FTP port is in the allowed ports so idk why it wont work with CSF enabled.
 
you need to enable some outgoing port for TCP and TCP6

Code:
21
35000:35999
35000:35999 is range of port for passive mode FTP, put config in csf firewall.


###note, root account will automatics allowed in all port, you might not notice this when testing connection from the root account.
 
you need to enable some outgoing port for TCP and TCP6

Code:
21
35000:35999
35000:35999 is range of port for passive mode FTP, put config in csf firewall.


###note, root account will automatics allowed in all port, you might not notice this when testing connection from the root account.
Thanks for youre fast reply!!

1725649969628.png


I've added those ports. Also restarted CSF and LFD. Tho when making an admin backup i get an message that it failed. Again with the same error from above (port 21 after 1234 ms: Connection refused).
 
ahhh, I'm out of idea. it could be some blocklist of csf firewall.

I don't know which's IPs of hetzner using.

while still have some problem, just temporary allow your admin account for all outgoing port until you solves blocked problem to hetzner.

#/etc/csf/csf.alllow
Code:
udp|out|u=1001

1001 = id of admin account, it can find by cli "id -u admin"
 
Back
Top