Site icon GetPageSpeed

FTP backups to remote server

We all know that regular backups are important. But not all of us do any backups at all. When something breaks, it leads to a great amount of regret about not spending time to setup backups. Let’s learn how to setup FTP backups to remote server.

Some hosting companies provide free backup space. Option varies by the protocol used that you can use for accessing the backup storage. Samba is the best choice. However, some providers limit things to FTP. Below we explain how you can perform FTP backups of complete directory structure.

First, install LFTP utility:

yum install lftp

Then, you can run backup manually like this:

/usr/bin/lftp -e 'mirror —verbose -R /var/www/html /some/ftp/dir; bye;' -u username,password 1.2.3.4

Replace /some/ftp/dir with a directory you created for backups on FTP server, change /var/www/html to local directory that you want to backup. Username and password are FTP credentials of backup space. Replace 1.2.3.4 with IP address or hostname of FTP server.

To run FTP backup daily, simply put as cron job:

@daily /usr/bin/lftp -e 'mirror --verbose -R /var/www/html /some/ftp/dir; bye;' -u username,password 1.2.3.4

This will backup contents of a directory to remote FTP location, once a day.

Exit mobile version