error with userbackup after installing Installatron

magis010

Verified User
Joined
Dec 5, 2016
Messages
51
Hello

After installing Installatron the admin backup no longer work:
/usr/bin/curl returned error code 7
curl: (7) Failed to connect to IPHERE port 21: Connection refused
FTP informatie is ongeldig. (< Means invalid)

The Installatron plugin can push its backups on ftp to the destination

If i set back an backup of the vps the admin backup does work like its intended to do

What is the catch here?

Thanks Alot
 
Does anyone have for me the sollution that this do work beside installatron the softaculous key is soon not valid and i want to step back to installatron
1668525621523.png
 
look like you forgot to censor your ftp ip in image on line contains "output: curl:".
if no problem to show your server ips. it fine.
 
similar thread and possible solution (chmod ftp_upload.php file) here
 
similar thread and possible solution (chmod ftp_upload.php file) here

@johannes,

Actually there is no need to overwrite a custom version of the script with an original one (it is mentioned in the thread you are referring to). It's sufficient to remove a custom version, unless it breaks Installatron. If the the custom version was installed by Installatron. This is what I'd like to understand.
 
Do you have probably /usr/local/directadmin/scripts/custom/ftp_upload.php installed on your server?
This file is not there but it works if installatron is off or uninstalled once its on it gaves this
* How do i get that file? seems my DA do misses alot of files :(
 
Last edited:
That's OK. You don't need the file. My guess was that Installatron adds this file and it breaks backups.
Do you have anything under /usr/local/directadmin/scripts/custom/? Do you have anything useful in Installatron logs?
 
That's OK. You don't need the file. My guess was that Installatron adds this file and it breaks backups.
Do you have anything under /usr/local/directadmin/scripts/custom/? Do you have anything useful in Installatron logs?
Your guess is right installatron breaks the user backups the script backups do work as they have to do but as an extra i am inneed of userbackups as well

1668594236083.png
 
So you seem to have the file /usr/local/directadmin/scripts/custom/ftp_upload.php installed. And what is its content?
 
So you seem to have the file /usr/local/directadmin/scripts/custom/ftp_upload.php installed. And what is its content?
This is what is in the file:
Code:
#!/bin/sh
VERSION=1.2
CURL=/usr/local/bin/curl
if [ ! -e ${CURL} ]; then
        CURL=/usr/bin/curl
fi
OS=`uname`;
DU=/usr/bin/du
BC=/usr/bin/bc
EXPR=/usr/bin/expr
TOUCH=/bin/touch
PORT=${ftp_port}
FTPS=0
MIN_TLS="--tlsv1.1"

MD5=${ftp_md5}

if [ "${ftp_secure}" = "ftps" ]; then
    FTPS=1
fi

SSL_REQD=""
if ${CURL} --help tls | grep -m1 -q 'ftp-ssl-reqd'; then
    SSL_REQD="--ftp-ssl-reqd"
elif ${CURL} --help tls | grep -m1 -q 'ssl-reqd'; then
    SSL_REQD="--ssl-reqd"
fi


#######################################################
# SETUP

if [ ! -e $TOUCH ] && [ -e /usr/bin/touch ]; then
    TOUCH=/usr/bin/touch
fi
if [ ! -x ${EXPR} ] && [ -x /bin/expr ]; then
    EXPR=/bin/expr
fi

if [ ! -e "${ftp_local_file}" ]; then
    echo "Cannot find backup file ${ftp_local_file} to upload";

    /bin/ls -la ${ftp_local_path}

    /bin/df -h

    exit 11;
fi

get_md5() {
    MF=$1

    if [ ${OS} = "FreeBSD" ]; then
        MD5SUM=/sbin/md5
    else
        MD5SUM=/usr/bin/md5sum
    fi
    if [ ! -x ${MD5SUM} ]; then
        return
    fi

    if [ ! -e ${MF} ]; then
        return
    fi

    if [ ${OS} = "FreeBSD" ]; then
        FMD5=`$MD5SUM -q $MF`
    else
        FMD5=`$MD5SUM $MF | cut -d\  -f1`
    fi

    echo "${FMD5}"
}

#######################################################

CFG=${ftp_local_file}.cfg
/bin/rm -f $CFG
$TOUCH $CFG
/bin/chmod 600 $CFG

RET=0;

#######################################################
# FTP
upload_file_ftp()
{
        if [ ! -e ${CURL} ]; then
                echo "";
                echo "*** Backup not uploaded ***";
                echo "Please install curl by running:";
                echo "";
                echo "cd /usr/local/directadmin/custombuild";
                echo "./build curl";
                echo "";
                exit 10;
        fi

        /bin/echo "user =  \"$ftp_username:$ftp_password_esc_double_quote\"" >> $CFG

        if [ ! -s ${CFG} ]; then
                echo "${CFG} is empty. curl is not going to be happy about it.";
                ls -la ${CFG}
                ls -la ${ftp_local_file}
                df -h
        fi

        #ensure ftp_path ends with /
        ENDS_WITH_SLASH=`echo "$ftp_path" | grep -c '/$'`
        if [ "${ENDS_WITH_SLASH}" -eq 0 ]; then
                ftp_path=${ftp_path}/
        fi

        ${CURL} --config ${CFG} --silent --show-error --ftp-create-dirs --upload-file $ftp_local_file  ftp://$ftp_ip:${PORT}/$ftp_path$ftp_remote_file 2>&1
        RET=$?

        if [ "${RET}" -ne 0 ]; then
                echo "curl return code: $RET";
        fi
}

#######################################################
# FTPS
upload_file_ftps()
{
    if [ ! -e ${CURL} ]; then
        echo "";
        echo "*** Backup not uploaded ***";
        echo "Please install curl by running:";
        echo "";
        echo "cd /usr/local/directadmin/custombuild";
        echo "./build curl";
        echo "";
        exit 10;
    fi

    /bin/echo "user =  \"$ftp_username:$ftp_password_esc_double_quote\"" >> $CFG

    if [ ! -s ${CFG} ]; then
        echo "${CFG} is empty. curl is not going to be happy about it.";
        ls -la ${CFG}
        ls -la ${ftp_local_file}
        df -h
    fi

    #ensure ftp_path ends with /
    ENDS_WITH_SLASH=`echo "$ftp_path" | grep -c '/$'`
    if [ "${ENDS_WITH_SLASH}" -eq 0 ]; then
        ftp_path=${ftp_path}/
    fi

    ${CURL} --config ${CFG} ${SSL_REQD} -k ${MIN_TLS} --silent --show-error --ftp-create-dirs --upload-file $ftp_local_file  ftp://$ftp_ip:${PORT}/$ftp_path$ftp_remote_file 2>&1
    RET=$?

    if [ "${RET}" -ne 0 ]; then
        echo "curl return code: $RET";
    fi
}

#######################################################
# Start

if [ "${FTPS}" = "1" ]; then
    upload_file_ftps
else
    upload_file_ftp
fi

if [ "${RET}" = "0" ] && [ "${MD5}" = "1" ]; then
    MD5_FILE=${ftp_local_file}.md5
    M=`get_md5 ${ftp_local_file}`
    if [ "${M}" != "" ]; then
        echo "${M}" > ${MD5_FILE}

        ftp_local_file=${MD5_FILE}
        ftp_remote_file=${ftp_remote_file}.md5

        if [ "${FTPS}" = "1" ]; then
            upload_file_ftps
        else
            upload_file
        fi
    fi
fi

/bin/rm -f $CFG

exit $RET
 
Well, that's rather weird. I've got this when comparing the original script with yours:

Code:
# cd /usr/local/directadmin/scripts
# diff --ignore-all-space custom/ftp_upload.php ftp_upload.php
1c1
< #!/bin/sh
---
> #!/bin/bash
7d6
< OS=`uname`;
53,55d51
<     if [ ${OS} = "FreeBSD" ]; then
<         MD5SUM=/sbin/md5
<     else
57d52
<     fi
66,68d60
<     if [ ${OS} = "FreeBSD" ]; then
<         FMD5=`$MD5SUM -q $MF`
<     else
70d61
<     fi
188a180
>

And how will it be on your side?

Code:
cd /usr/local/directadmin/scripts
diff --ignore-all-space custom/ftp_upload.php ftp_upload.php
?
 
Well, that's rather weird. I've got this when comparing the original script with yours:

Code:
# cd /usr/local/directadmin/scripts
# diff --ignore-all-space custom/ftp_upload.php ftp_upload.php
1c1
< #!/bin/sh
---
> #!/bin/bash
7d6
< OS=`uname`;
53,55d51
<     if [ ${OS} = "FreeBSD" ]; then
<         MD5SUM=/sbin/md5
<     else
57d52
<     fi
66,68d60
<     if [ ${OS} = "FreeBSD" ]; then
<         FMD5=`$MD5SUM -q $MF`
<     else
70d61
<     fi
188a180
>

And how will it be on your side?

Code:
cd /usr/local/directadmin/scripts
diff --ignore-all-space custom/ftp_upload.php ftp_upload.php
?
If i should see output them this is all i got:
1668678079617.png
 
And if you delete the script /usr/local/directadmin/scripts/custom/ftp_upload.php, will the backups start working again?
 
Nop
And if you delete the script /usr/local/directadmin/scripts/custom/ftp_upload.php, will the backups start working again?
ftp_upload.php output: curl: (7) Failed to connect to IPHERE port 21: Connection refused
curl return code: 7
<20:43:01>
Please see this URL and check for curl exit code '(7)': https://help.directadmin.com/item.php?id=2127


Nope it doesnt push files atleast it does create a folder in the FTP
 
And if you disable firewall temporary will it make any difference?
Ok csf is off and i see files :)

But now the next part what and how to do backups with lfd on and seeing data (With random timeouts i bet missing some data)
 
Last edited:
FTP passive ports 35000:35999 opened in CSF, in TCP IN/OUT?
also USE_FTPHELPER = must be "0"
 
Back
Top