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 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 email@example.com
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 protected]
Once you have successfully logged in, you will get to this prompt
sftp> indicating you are in an active
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