Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

LFTP How to

Published

FTPvps

If you manage websites or backups on an InterServer VPS or dedicated server, you will eventually need to move large batches of files between systems. While standard SFTP or FTP works fine for a handful of items, transferring thousands of product images, massive database dumps, or entire directory trees can easily stall out your connection.

That is where lftp comes in. It is a sophisticated, command-line file transfer utility built for speed and reliability. If your connection drops mid-transfer, lftp automatically reconnects and resumes exactly where it left off. More importantly, it supports multi-threading, meaning it can download multiple files simultaneously to maximize your InterServer port speed.

Here is a straightforward guide to getting lftp up and running on AlmaLinux 9, connecting to a remote system, and using its most powerful feature: directory mirroring.

—

Step 1: Install lftp on AlmaLinux 9

AlmaLinux 9 uses the dnf package manager. Because lftp is included in the default base repositories, you do not need to configure any third-party software sources.

Open your terminal, log into your InterServer system via SSH as root (or a user with sudo privileges), and run the following command:

sudo dnf install lftp -y

The system will resolve dependencies, download the package, and install it. You can verify it is ready to use by checking the version:

lftp --version

—

Step 2: Connect to a Remote System

The most secure way to connect to a remote server is via SFTP (SSH File Transfer Protocol). To open an interactive lftp session, pass your remote user credentials and the target hostname or IP address directly to the command:

lftp -u username,password sftp://remote-server-ip-or-domain

Tip: If you prefer not to leave your password visible in your shell history, omit the comma and password. The system will securely prompt you for it before connecting:

lftp -u username sftp://remote-server-ip-or-domain

Once connected, your command prompt will change to lftp username@...:>. You can now use standard navigation commands like ls to list remote files or cd to change remote directories.

—

Step 3: Mirror a Remote Directory Locally

The real power of lftp lies in the mirror command. Instead of downloading files one by one, mirroring looks at an entire remote directory structure and replicates it perfectly on your local InterServer storage node.

Before running the command, navigate to the remote folder you want to copy using cd /path/to/remote/folder. Then, execute the mirror command using this structure:

mirror --parallel=5 . /path/to/local/destination

Let’s break down exactly what this command is doing:

  • mirror: Tells lftp to synchronize a remote directory to a local directory.
  • --parallel=5: Activates multi-threading. This forces lftp to download up to 5 files at the exact same time, which drastically cuts down transfer times for large websites. You can adjust this number based on your needs.
  • . (The Dot): Represents the current remote directory you are standing in.
  • /path/to/local/destination: The exact absolute path on your AlmaLinux 9 server where you want the files to land.

Handling Interrupted Transfers

If you are moving hundreds of gigabytes and the network hiccups, you do not have to start over. Simply log back in, run the exact same command, and add the -c (continue) flag:

mirror -c --parallel=5 . /path/to/local/destination

lftp will scan both sides, skip everything that already matches, and resume downloading the files that were cut off.

—

Closing Your Session

Once your transfer finishes and the prompt returns to idle, type exit or quit to close the remote connection and return to your standard AlmaLinux terminal prompt.

If you run into any permission issues creating local directories or have trouble routing traffic out of your server, remember that InterServer’s 24/7 support team is available via your account manager to help verify your network environment.

Related guides

Account services are unavailable until the production backend is configured.