From time to time on Codeable I need to clone a site to a VPS with root access in order to diagnose WordPress/WooCommerce performance issues. My internet connection is fast but it’s not as fast as most VPS providers’ network pipes!
When SSH isn’t available so you can use rsync to copy over large files, SFTP can be a handy workaround if the backup archives are on the source server in an (S)FTP directory. This is very similar to speeds using wget to download backup archives but that usually implies that the download backup is publicly available which we don’t always want with GDPR and all!
This tutorial will show you how to download these WordPress backup archives on to your VPS from the live server using the
sftp utility on Linux for very fast transfers. I also cover how to use an SSH key for authentication and how to change the port that
sftp connects to in case the SFTP server uses a port besides the default 22.
Download WordPress Backup from SFTP via Linux Command Line
Linux has an sftp command that you can use to browse SFTP servers storing your backups.
The basic syntax for
sftp is using
username as the SFTP user and @
ftp.address.com as the IP address or DNS name of the SFTP server
If you are using a different port on the SFTp server you can specify this with the
Here is an example on WPEngine.
sftp -oPort=2222 firstname.lastname@example.org
You can also specify an SSH private key to use with the
Here is an example for accessing a site on Kinsta on port 25556
sftp -oIdentifyFile=/home/wpbullet/id_rsa.key -oPort=25556 email@example.com
Once you have successfully logged in, you will get to this prompt
sftp> indicating you are in an active
ls command will list the files and folders so we can make sure we are in the right path
cd (change directory) command we can enter the
sftp> cd _wpeprivate
We can now download the backup archive using the
get command followed by the
filename of the backup archive.
sftp> get filename
It is a very beautiful thing to see a database backup downloading so quickly!
Fetching /_wpeprivate/wp_mytestsite.sql to wp_mytestsite.sql 100% 378MB 34.4MB/s 00:11 /_wpeprivate/wp_mytestsite.sql
Download WordPress Backup from FTP via Linux Command Line
You will need the
ftp binary first, to install this on Debian and Ubuntu use this
sudo apt install ftp
Then you can use the
ftp commmand like this where
ftp.flamecgi.wp-bullet.com is the FTP address you want to download the backup from
You will get some output like this where you will be prompted for your FTP username and password
Connected to ftp.flamecgi.wp-bullet.com. 220---------- Welcome to Pure-FTPd [privsep] [TLS] ---------- 220-You are user number 1 of 50 allowed. 220-Local time is now 09:51. Server port: 21. 220-This is a private system - No anonymous login 220-IPv6 connections are also welcome on this server. 220 You will be disconnected after 15 minutes of inactivity. Name (ftp.flamecgi.wp-bullet.com:root): firstname.lastname@example.org 331 User email@example.com OK. Password required Password: 230 OK. Current restricted directory is / Remote system type is UNIX. Using binary mode to transfer files.
You will now see this prompt indicating you are in an active FTP session
In terms of downloading the backup file it is the same as it was for the sftp command
ftp> get filename
And enjoy the speed!