Mengatasi FTP Error during Backup Creation di DirectAdmin dengan Mudah

Backup Di DIrectadmin Gagal

Pentingnya Backup di DirectAdmin

Bagi seorang admin server atau pemilik website, backup adalah hal yang wajib. Bayangkan kalau tiba-tiba server rusak, file hilang, atau website kena serangan. Tanpa backup, semua data bisa lenyap begitu saja. DirectAdmin, sebagai salah satu control panel populer, menyediakan fitur backup otomatis yang bisa disimpan di server lokal maupun remote (seperti lewat FTP).

Kenapa sering muncul error FTP saat backup

Sayangnya, saat mencoba menyimpan backup ke server remote lewat FTP, kadang muncul error: “FTP Error during Backup Creation”. Pesan ini membuat backup gagal terkirim, dan bagi sebagian orang cukup bikin panik. Padahal, error ini biasanya punya penyebab yang jelas dan bisa diatasi dengan langkah-langkah sederhana.


Memahami Cara Kerja Backup di DirectAdmin

Mekanisme backup lokal vs remote

DirectAdmin punya dua opsi utama:

  • Backup lokal: disimpan langsung di server.

  • Backup remote: dikirim ke server lain via FTP/SFTP/FTPS.

Peran FTP dalam proses backup

Saat kamu memilih backup remote via FTP, DirectAdmin akan:

  1. Membuat file backup di server lokal.

  2. Membuka koneksi FTP ke server tujuan.

  3. Mengunggah file backup ke folder yang sudah ditentukan.

Jika salah satu langkah gagal, akan muncul error.

Jenis error yang umum terjadi

  • “Authentication failed” → biasanya salah username atau password.

  • “Connection refused” → port FTP tidak terbuka.

  • “Disk quota exceeded” → ruang penyimpanan di server tujuan habis.

  • “Timeout error” → firewall atau jaringan memblokir koneksi.


Penyebab utama FTP Error during Backup Creation

Kredensial FTP yang salah

Kesalahan kecil seperti salah mengetik password atau folder tujuan bisa bikin backup gagal.

Port FTP tidak terbuka

Default FTP pakai port 21. Kalau port ini ditutup firewall, koneksi pasti gagal.

Firewall atau security rules

Kadang server tujuan punya firewall yang membatasi koneksi dari luar.

Masalah disk space pada server tujuan

Backup biasanya ukurannya besar. Kalau disk server tujuan penuh, file tidak akan bisa diunggah.

Setting passive mode yang belum tepat

FTP punya dua mode: active dan passive. Kalau server atau firewall tidak mendukung salah satunya, koneksi bisa error.


Cara Mengatasi Error FTP di DirectAdmin

1. Cek kredensial FTP

Username dan password benar

Pastikan username FTP sudah benar. Kalau pakai cPanel atau DirectAdmin di server tujuan, biasanya format usernya username@domain.com. Jangan lupa cek password dengan mencoba login manual.

Path folder tujuan

Periksa apakah folder tujuan benar-benar ada dan bisa ditulisi. Misalnya /backups/ harus sudah dibuat di server FTP tujuan.


2. Pastikan port FTP terbuka

Default port 21

Cek apakah port 21 terbuka dengan perintah:

telnet ftp.domain.com 21

Kalau gagal, artinya port tertutup.

Passive ports configuration

FTP pasif menggunakan range port tertentu (misalnya 30000–35000). Pastikan range ini dibuka di firewall server FTP.


3. Periksa firewall dan security

Iptables/Firewalld setting

Di server Linux, buka port FTP dengan perintah:

iptables -A INPUT -p tcp --dport 21 -j ACCEPT

Konfigurasi CSF (ConfigServer Security & Firewall)

Jika pakai CSF, pastikan port 21 dan passive ports sudah ditambahkan di file konfigurasi csf.conf.


4. Cek disk space server tujuan

Gunakan perintah df -h

Login ke server FTP tujuan lalu jalankan:

df -h

Jika disk penuh, hapus file lama atau tambah kapasitas.

Bersihkan file lama

Banyak admin lupa menghapus backup lama. Akibatnya ruang penuh. Buat jadwal otomatis untuk membersihkan backup lama agar tidak menumpuk.


5. Gunakan passive mode di DirectAdmin

Setting passive mode di DirectAdmin

Saat menambahkan server FTP di menu backup DirectAdmin, centang opsi passive mode. Biasanya ini membantu melewati firewall.

Konfigurasi di file /etc/proftpd.conf

Jika pakai ProFTPD sebagai FTP server, tambahkan:

PassivePorts 30000 35000

dan buka range tersebut di firewall.


6. Uji FTP secara manual

Gunakan command line ftp atau lftp

Sebelum pakai DirectAdmin, coba tes manual dengan:

ftp ftp.domain.com

atau

lftp -u username,password ftp.domain.com

Pastikan bisa upload file kecil

Upload file kecil seperti test.txt. Kalau sukses, berarti masalah bukan di FTP tapi setting backup DirectAdmin.


Alternatif solusi jika FTP tetap error

Gunakan SFTP/FTPS untuk lebih aman

Kalau FTP bermasalah atau diblokir ISP, coba ganti ke SFTP (port 22) atau FTPS (FTP over SSL). Lebih aman dan biasanya lebih stabil.


Cek apakah file di /usr/local/directadmin/scripts/ftp_list.php dan /usr/local/directadmin/scripts/ftp_upload.php mendukung SFTP atau tidak. jika tidak perlu penyesuaian sebagai berikut.

/usr/local/directadmin/scripts/ftp_list.php

#!/bin/bash


CURL=/usr/local/bin/curl

if [ ! -e ${CURL} ]; then

CURL=/usr/bin/curl

fi

TMPDIR=/home/tmp

PORT=${ftp_port}

FTPS=0

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

FTPS=1

fi

SHOW_BYTES=0

if [ "${ftp_show_bytes}" = "yes" ]; then

SHOW_BYTES=1

fi


int_version() {

        local major minor patch

        major=$(cut -d . -f 1 <<< "$1")

        minor=$(cut -d . -f 2 <<< "$1")

        patch=$(cut -d . -f 3 <<< "$1")

        printf "%03d%03d%03d" "${major}" "${minor}" "${patch}"

}


SSL_ARGS=""

if [ "$FTPS" != "0" ]; then

CURL_TLS_HELP=$(${CURL} --help tls)

CURL_VERSION=$(${CURL} --version | head -n 1 | cut -d ' ' -f 2)


if grep -q 'ftp-ssl-reqd' <<< "${CURL_TLS_HELP}"; then

SSL_ARGS="${SSL_ARGS} --ftp-ssl-reqd"

elif grep -q 'ssl-reqd' <<< "${CURL_TLS_HELP}"; then

SSL_ARGS="${SSL_ARGS} --ssl-reqd"

fi

# curl 7.77.0 fixed gnutls ignoring --tls-max if --tlsv1.x was not specified.

# https://curl.se/bug/?i=6998

#

# curl 7.61.0 fixes for openssl to treat --tlsv1.x as minimum required version instead of exact version

# https://curl.se/bug/?i=2691

#

# curl 7.54.0 introduced --max-tls option and changed --tlsv1.x behaviur to be min version

# https://curl.se/bug/?i=1166

if [ "$(int_version "${CURL_VERSION}")" -ge "$(int_version '7.54.0')" ]; then

SSL_ARGS="${SSL_ARGS} --tlsv1.1"

fi


# curl 7.78.0 fixed FTP upload TLS 1.3 bug, we add `--tls-max 1.2` for older versions.

# https://curl.se/bug/?i=7095

if [ "$(int_version "${CURL_VERSION}")" -lt "$(int_version '7.78.0')" ] && grep -q 'tls-max' <<< "${CURL_TLS_HELP}"; then

SSL_ARGS="${SSL_ARGS} --tls-max 1.2"

# curls older than 7.61.0 needs --tlsv.x parameter for --tls-max to work correctly

# https://curl.se/bug/?i=2571 - openssl: acknowledge --tls-max for default version too

fi


fi


if [ "$PORT" = "" ]; then

PORT=21

fi


RANDNUM=`/usr/local/bin/php -r 'echo rand(0,10000);'`

#we need some level of uniqueness, this is an unlikely fallback.

if [ "$RANDNUM" = "" ]; then

        RANDNUM=$ftp_ip;

fi


CFG=$TMPDIR/$RANDNUM.cfg

rm -f $CFG

touch $CFG

chmod 600 $CFG


DUMP=$TMPDIR/$RANDNUM.dump

rm -f $DUMP

touch $DUMP

chmod 600 $DUMP


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

# FTP


PROTO="ftp"

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

PROTO="sftp"

fi


list_files()

{

if [ ! -e ${CURL} ]; then

echo "";

echo "*** Unable to get list ***";

echo "Please install curl";

echo "";

exit 10;

fi


#double leading slash required, because the first one doesn't count.

#2nd leading slash makes the path absolute, in case the login is not chrooted.

#without double forward slashes, the path is relative to the login location, which might not be correct.

ftp_path="/${ftp_path}"


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


${CURL} --config ${CFG} ${SSL_ARGS} -k --silent --show-error ${PROTO}://$ftp_ip:${PORT}$ftp_path/ > ${DUMP} 2>&1

RET=$?


if [ "$RET" -ne 0 ]; then

echo "${CURL} returned error code $RET";

cat $DUMP

else

COLS=`awk '{print NF; exit}' $DUMP`

if [ "${SHOW_BYTES}" = "1" ] && [ "${COLS}" = "9" ]; then

cat $DUMP | grep -v -e '^d' | awk "{ print \$${COLS} \"=\" \$5; }"

else

cat $DUMP | grep -v -e '^d' | awk "{ print \$${COLS}; }"

fi

fi

}



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

# Start


list_files


rm -f $CFG

rm -f $DUMP


exit $RET

di  /usr/local/directadmin/scripts/ftp_upload.php
 

#!/bin/bash

VERSION=1.2


CURL=/usr/local/bin/curl

if [ ! -e ${CURL} ]; then

    CURL=/usr/bin/curl

fi


DU=/usr/bin/du

BC=/usr/bin/bc

EXPR=/usr/bin/expr

TOUCH=/bin/touch

PORT=${ftp_port}

FTPS=0

MD5=${ftp_md5}


# Tentukan protokol

PROTO="ftp"

if [ "${ftp_secure}" = "sftp" ]; then

    PROTO="sftp"

elif [ "${ftp_secure}" = "ftps" ]; then

    PROTO="sftp"

    FTPS=1

fi


CURL_TLS_HELP=$(${CURL} --help tls)

CURL_VERSION=$(${CURL} --version | head -n 1 | cut -d ' ' -f 2)


int_version() {

    local major minor patch

    major=$(cut -d . -f 1 <<< "$1")

    minor=$(cut -d . -f 2 <<< "$1")

    patch=$(cut -d . -f 3 <<< "$1")

    printf "%03d%03d%03d" "${major}" "${minor}" "${patch}"

}


SSL_ARGS=""

if grep -q 'ftp-ssl-reqd' <<< "${CURL_TLS_HELP}"; then

    SSL_ARGS="${SSL_ARGS} --ftp-ssl-reqd"

elif grep -q 'ssl-reqd' <<< "${CURL_TLS_HELP}"; then

    SSL_ARGS="${SSL_ARGS} --ssl-reqd"

fi


# curl 7.54.0+ → support tls-minimum

if [ "$(int_version "${CURL_VERSION}")" -ge "$(int_version '7.54.0')" ]; then

    SSL_ARGS="${SSL_ARGS} --tlsv1.1"

fi


# curl < 7.78.0 bug TLS1.3 → limit max ke 1.2

if [ "$(int_version "${CURL_VERSION}")" -lt "$(int_version '7.78.0')" ] && grep -q 'tls-max' <<< "${CURL_TLS_HELP}"; then

    SSL_ARGS="${SSL_ARGS} --tls-max 1.2"

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

    MD5SUM=/usr/bin/md5sum

    if [ ! -x ${MD5SUM} ]; then

        return

    fi

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

        return

    fi

    FMD5=$(${MD5SUM} $MF | cut -d' ' -f1)

    echo "${FMD5}"

}


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


CFG=${ftp_local_file}.cfg

/bin/rm -f $CFG

$TOUCH $CFG

/bin/chmod 600 $CFG


RET=0


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

# Upload function


upload_file() {

    if [ ! -e ${CURL} ]; then

        echo ""

        echo "*** Backup not uploaded ***"

        echo "Please install 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_ARGS} -k --silent --show-error \

        --ftp-create-dirs --upload-file $ftp_local_file \

        ${PROTO}://$ftp_ip:${PORT}/$ftp_path$ftp_remote_file 2>&1


    RET=$?

    if [ "${RET}" -ne 0 ]; then

        echo "curl return code: $RET"

    fi

}


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

# Start


upload_file


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


        upload_file

    fi

fi


/bin/rm -f $CFG

exit $RET

Lalu coba ulang menggunakan sftp. 

Backup lokal dulu, baru upload manual

Kamu bisa backup ke server lokal dulu, lalu gunakan cron job dengan rsync atau scp untuk memindahkan ke server remote.

Integrasi dengan rsync untuk transfer lebih stabil

Rsync lebih cepat karena hanya mentransfer file yang berubah. Cocok untuk backup rutin.


Best practice backup di DirectAdmin

Jadwalkan backup otomatis

Gunakan cron di DirectAdmin untuk menjadwalkan backup harian atau mingguan.

Simpan backup di beberapa lokasi

Jangan hanya bergantung pada satu server. Simpan di cloud, server lain, atau bahkan storage eksternal.

Monitoring notifikasi backup

Aktifkan email notifikasi agar kamu tahu apakah backup berhasil atau gagal.


Studi kasus nyata

Error karena password FTP salah

Seorang admin sering gagal backup karena password salah ketik. Setelah reset password FTP, masalah selesai.

Error karena firewall blokir port 21

Ada kasus backup gagal terus. Setelah dicek, ternyata firewall di server tujuan menutup port 21. Begitu dibuka, backup langsung sukses.

Error karena disk space penuh

Salah satu server backup gagal menerima file. Setelah cek dengan df -h, ternyata disk sudah 100%. Setelah hapus file lama, backup berjalan normal.


Tips tambahan untuk admin server

Selalu tes backup sebelum butuh restore

Backup tidak ada gunanya kalau tidak bisa dipulihkan. Cobalah restore backup ke server lain sebagai uji coba.

Gunakan server backup khusus

Kalau memungkinkan, siapkan server khusus hanya untuk backup. Ini lebih aman dan terorganisir.

Dokumentasikan setting backup

Catat username, password, port, dan setting lain di dokumentasi internal agar mudah dicek kalau ada masalah.


Kesimpulan

Inti solusi FTP error di DirectAdmin

Sebagian besar error FTP di DirectAdmin disebabkan hal-hal sederhana: kredensial salah, port tertutup, firewall ketat, atau disk penuh. Dengan langkah pengecekan yang sistematis, masalah ini bisa cepat diatasi.

Pentingnya backup yang teruji

Backup bukan hanya soal membuat salinan data, tapi juga memastikan salinan itu bisa diakses dan dipulihkan saat dibutuhkan. Jadi, pastikan backup diuji secara berkala.


FAQ

1. Apa bedanya FTP, SFTP, dan FTPS di DirectAdmin?
FTP adalah protokol dasar. SFTP menggunakan SSH (port 22) sehingga lebih aman. FTPS menggunakan SSL/TLS untuk enkripsi.

2. Kenapa backup kadang sukses, kadang gagal?
Biasanya karena jaringan tidak stabil, disk space hampir penuh, atau firewall kadang menolak koneksi.

3. Apakah bisa backup tanpa FTP di DirectAdmin?
Bisa, DirectAdmin mendukung backup lokal. Kamu bisa pindahkan manual dengan rsync atau scp.

4. Bagaimana cara cek log error backup?
Login ke DirectAdmin sebagai admin, lalu buka menu “Message System” atau cek log di /var/log/directadmin.

5. Apakah perlu pakai server backup eksternal?
Sebaiknya iya. Jangan hanya simpan backup di server utama. Kalau server rusak total, backup tetap aman di luar.

Posting Komentar (0)
Lebih baru Lebih lama