Uploadscript doesn't upload the gzip

Aar

Verified User
Joined
Feb 10, 2005
Messages
209
Location
Netherlands
Hello,

I have this uploadscript:
Bash:
#!/bin/sh

datum=`date +%u`;
`echo "action=backup&ftp_ip=123.123.123.123&ftp_username=USER&ftp_password=TOP_SECRET=&ftp_path=/$datum/&owner=admin&type=admin&value=multiple&when=now&where=ftp&who=all" >> /usr/local/directadmin/data/task.queue`

But, it doesn't work:
I see this (and repeating for all users)

User admin has been backed up. <22:48:02>
ftp_upload.php exit code: 7
ftp_upload.php output: curl: (7) Failed to connect to 123.123.123.123 port 21: Connection refused
curl return code: 7
<22:48:04>
Please see this URL and check for curl exit code '(7)': https://help.directadmin.com/item.php?id=2127

The connection looks fine. Even the rights on the ftp are fine. I see a new directory in the FTP with '5' (from datum).
But the problems are the gzipped files. They weren't uploaded.

In the options.conf, i see:
Code:
curl = no
Curl is compiled in PHP, but why has this the value no?

What is wrong?
 
Last edited:
Right, thats clear, but could this be the problem with uploading with FTP?

And can i solve this with:
./build curl ?
 
if you want Curl maintained by CB instead of OS.
Set curl=yes
Then do build curl.
you also need to uninstall the OS binary
then as well.

It might depending on how old the OS curl is.
 
What is wisdom?
And can I solve with this step the error/exit code 7 of CURL when uploading with FTP?
 
add your ftp IP to the firewall whitelist.
I don't think thats the problem, because this:

The connection looks fine. Even the rights on the ftp are fine. I see a new directory in the FTP with '5' (from datum).
...but the upload of the archive fails....?
Any idea?
 
Last edited:
You can try anyway.
I have both system and custombuild curl in place, doesn't cause issues.
If it works with custombuild curl, then you found a bug, you can always remove system curl later.

You say the connection works fine, but in your log I see "connection refused" or is that after the upload succeeded?
Could it be some firewalling issue on the receiving site? Maybe NAT issues so maybe PASV must be used?

It was a lot easier to work with ncftpput which was used formerly then now with curl. I have no clue on how PASV should be set with curl if needed.
 
I don't think a firewall is the issue. A connection is made, the directory is created, but the upload fails

Maybe is the FTP-server on the backup-server the problem? But how?
The only thing what i think is a setting about 'passive mode'.
 
Just my thought, if connections are good then PASV mode might be the culprit.
But you might be able to test this using ncftpput via SSH and see what it does. If I'm not mistaken ncftpput uses passive by default.
If it works with ncftpput, then you might be a bit nearer to a solution.

On the other hand, curl uses passive mode by default too.... so now I get confused.
 
I've turned on Passive Mode on the FTP server at the backup-machine, but it doesn't seem to help.

From the CLI with ncftpput the file is succesfully transferred.
But when i use the Admin and Backup transfer, i see this error?

/usr/bin/curl returned error code 7
curl: (7) Failed to connect to 5.135.181.236 port 21: Connection refused
FTP information invalid.​
How come?
Why it's refused, while ncftpput is working?

I use the OS-based Curl version 7.61.1.
 
So it was the firewall after all.
Apparently passive mode is used, and I had not filled in the ports TCP_OUT ports for passive mode. :)

I find it strange that ncftpput worked, but curl did not. I suspect Curl is doing this through a passive transfer.

Well, it's solved.
 
Last edited:
Oh LoL... well sometimes we keep staring us blind at things why it doesn't work... like our good Dutch saying "door de bomen het bos niet meer zien". In this case, it could only be something with pasv not respondig somehow.

I find it strange that ncftpput worked, but curl did not.
Yeah that's indeed odd, as both work by default via PASV. So I wonder if curl doesn't switch to plain ftp on port 21 if passive does not work correctly and ncftpput does... strange indeed.

Glad it's fixed now. :)
 
Back
Top