Webmail Login
Control Panel Login
How to copy data from one server to another using SSH, LFTP and screen
.CO.UK ONLY £5.33
Find your perfect domain here

How to copy data from one server to another using SSH, LFTP and screen

Copying files from one server to another using SSH is great but not all hosting packages support SSH. So what do you do in instances where only one server has SSH access? You use LFTP.

LFTP allows you to copy files from one server to another when only one server has SSH access. Below we will guide you on how to achieve this and how to use Screen. We won't go into detail regarding screen in here but in brief it allows you to close your SSH client and keep the session running. This can be very useful if you have a lot to copy and don't want to leave your computer on.

The below guide was created using a VPS (running CentOS7 and a shared hosting package with Squirrel Hosting). Some commands may vary depending on your OS.

1) Log into your server via SSH.

Open up a SSH client e.g. Putty and log into your server.

2) Install Screen

yum install screen

Install Screen

Press "y" then enter.

Your server will now install screen and once finished, will show the complete message.

3) Open a screen session.

Next, we will open a new screen (think of this as a virtual computer screen you can leave running).

Run the command:


You should now be presented with a new blank screen.

4) Install LFTP.

sudo yum install lftp

then press Y and enter when prompted.


Again, once finished, you should see a complete message.

5) Find the data

Next, you will want to navigate into the folder where the data you want to copy is located. You can use:

cd ..

to go back a folder and

cd foldername

to open a folder. Use:


to view the files/folders in the current folder.

Locate data

6) Connect to the other server via LFTP

Once you are in the folder you want to copy across, we will need to connect to the other server via LFTP. Enter the following command:

lftp ftp://username@host

replace username with your FTP username and host with your FTP host address (e.g. ftp.yourdomain.co.uk)

Enter the FTP password when prompted.

LFTP connected

You should now be connected to your other hosting via FTP.

4) Navigate to the correct location you want the files copying to

Navigate into the folder you want to copy the files to e.g. using "ls" and "cd" like before.

copy files to

5) Mirror

So to recap, you should have navigated to where the files are that you want to copy, and the folder (via LFTP) where you want to copy them to. To clarify, you can specify the folder manually if you know the full paths.

Now we can start copying the files.

Type in

mirror -R

to start the copying.

Copy completed mirror -r

Once complete, you will see the total amount of files etc copied.

That's it. To exit the screen (and close it down), type:


You will likely also need to type exit again (since the first exit will close LFTP).

To disconnect from a screen (so it stays running), Hold down CTRL then press A followed by D.

To re-connect to a screen, type :

screen -r

For a full list of screen commands and check out Tournas Dimitrios blog post here.

Have you used the above method on your server? Do you prefer alternative methods? Please let us know in the comments below.

Leave a comment

Has this guide helped you? Have an idea for a guide or need help? Let us know below.

© Copyright 2014 | Squirrel Hosting