How to: Backup to FTP with NCFTP

Showing an easy way of copying your files to an remote FTP Server.

Install ncftpapt-get install ncftp

apt-get install ncftp

Create ncftp-serverconfig

/root/.ncftp/backupserver.cfg
host <server-ip/hostname>
user <username>
pass <password>

Create CronJob

/etc/cron.d/backup
40 2 * * *     root     ncftpput -f /root/.ncftp/backupserver.cfg -vZmRF /ftp-directory/ /local-backup/* 1>/dev/null

This way you will recieve warnings/errors.

Flags

-f <Filename> Serverconfig
-m try to create directory
-R recursivly
-v verbose progress
-Z enable PassivTransfer

Debugging

If something is going wrong, try to use the “-d <filename>” to enable debugging for more details.

Tips

To keep your BackupSpace clean you can also issue an delete command before uploading.
Simply add: -W “delete /directory/*”
Unfortunately you can’t delete recursivly, since it’s assuming rm as delete.

2 Comments

  1. Jordi says:

    So, if it can’t delete recursively, this is a very unefficient way of backup… Or is it any way to clean the remote disk before copying?

  2. wese says:

    You can use lftp to clean the remote directory.
    I have abandoned ftp backups for quite some time, so there may be better solutions out there for this type of problem.

Leave a Reply