Ubuntu – Copy all files from another server by FTP

Moving servers from one infrastructure to another. In our case, from Webfusion UK to AWS.

Problem we face is that there are over 82Gb of files to move from one server to another. Traditionally we would have downloaded them all locally, then uploaded them, but what if there was a way to transfer them directly from one server to another.

We turned on FTP on the source server, and updated the firewall so that only the destination IP could connect.

Then on the destination server we can simply type:

wget -r ftp://sourceip/folderinftproot/* –ftp-user=username –ftp-password=password -P /var/www/html/ -q

This copies all folders from the FTP root on the source server in to the web root of the new server.

To transfer 82Gb of data between data-centres took 14 minutes, compared to the older download-upload method we used to use that took several overnights of downloading locally!

And of course, remembering to turn off FTP on the source server once completed!

Raspberry Pi – Set up FTP

To set up FTP on the raspberry pi so that we can upload files for the website in www

First, we need to have permission to access the www folder

sudo chown -R pi /var/www

Next, we install FTP

sudo apt-get install vsftpd

Then edit the configuration file for vsftpd

sudo nano /etc/vsftpd.conf

Make the following changes to the configuration file

anonymous_enable=YES -> anonymous_enable=NO
#local_enable=YES -> local_enable=YES
#write_enable=YES -> write_enable=YES
#local_umask=022 -> local_umask=777
#chown_uploads=YES -> chown_uploads=YES
#chown_username=pi -> chown_username=www-data

Add the following to the end of the file:


Then restart the service:

sudo service vsftpd restart

Create a shortcut so that the www folder appears in the FTP root:

ln -s /var/www/ ~/www