<< Back to tutorials

FTP Migration – From Self-Hosted to Managed Cloud

Published {$created} by Carsten Blum


Running your own FTP server can be time-consuming: patches, certificates, firewalls, and hardware maintenance all add complexity. That’s why many teams migrate from self-hosted FTP to a secure managed cloud FTP hosting service like ftpGrid. In this tutorial, we’ll show you how to migrate your files with bash scripts using standard tools like lftp and scp. The goal: move everything from your old FTP host into a secure, GDPR-compliant environment — with minimal downtime.


In order to follow this guide, we recommend you create an account with ftpGrid by following our getting started guide . Using managed FTP hosting has many advantages, which you can read about in our brief about managed FTP hosting.

Basic knowledge with bash and terminal is assumed in this tutorial.



Preparing for Migration

Before starting, gather:

  • Credentials for your old FTP server (host, username, password).

  • Your ftpGrid account with SFTP or FTPS enabled.

  • A Linux or macOS environment (Windows users can run these scripts in WSL).



Option 1: Migrate with lftp mirror

lftp is a powerful FTP/SFTP/FTPS client that supports recursive mirroring.


1. Install lftp

# Ubuntu/Debian 
sudo apt install lftp 

# macOS (Homebrew)
brew install lftp 


2. Mirror from old FTP → ftpGrid via SFTP

Steps 2, 3 and 4 is to be combined into on long script, for example ftp-migrate.sh.


#!/bin/bash 
OLD_HOST="oldftp.example.com"
OLD_USER="olduser"
OLD_PASS="oldpass"

NEW_HOST="edge1.ftpgrid.com"
NEW_USER="newuser"
NEW_PASS="newpass"


3. Mirror from old host to local

lftp -u "$OLD_USER","$OLD_PASS" "ftp://$OLD_HOST" <<EOF
mirror --verbose --parallel=4 / ./local_mirror
bye
EOF


4. Mirror local to ftpGrid (SFTP)

lftp -u "$NEW_USER","$NEW_PASS" "sftp://$NEW_HOST" <<EOF
mirror --reverse --verbose --parallel=4 ./local_mirror /uploads
bye
EOF



This script, combined from bullets 2,3 and 4:

  1. Downloads everything from the old FTP server into ./local_mirror.

  2. Uploads it securely to ftpGrid’s /uploads directory via SFTP.



Option 2: Use scp for One-Off Bulk Copy

If your old server supports SCP/SSH, you can copy files directly to ftpGrid without extra tooling. Create the script ftp-migrate-scp.sh with this content:


#!/bin/bash 
OLD_USER="olduser"
OLD_HOST="oldftp.example.com"

NEW_USER="newuser"
NEW_HOST="edge1.ftpgrid.com"

scp -r $OLD_USER@$OLD_HOST:/var/ftp/data/* $NEW_USER@$NEW_HOST:/uploads/


This skips the local staging step and transfers everything directly via SCP. In this case you could also use SSH keys which is highly recommended. Please follow our tutorial on creating and using SSH keys for authentication with SFTP and SCP.



Best Practices During Migration

  • Test with a subset first – run scripts on a small folder before migrating everything.

  • Schedule downtime carefully – avoid overwriting new uploads if users still write to the old FTP.

  • Verify integrity – compare file counts and spot-check critical files.

  • Switch DNS last – only point clients to the new ftpGrid host once the migration is verified.



Why Migrate to Managed Cloud FTP Hosting?

With ftpGrid you get:

  • Automatic SSL/TLS certificate management (Let’s Encrypt).

  • GDPR-compliant hosting in Germany (Hetzner).

  • Encryption in transit and at rest.

  • Zero server maintenance — focus on your data, not the infrastructure.



Conclusion

Migrating from a self-hosted FTP server to managed cloud FTP hosting is straightforward with the right tools.By using lftp or scp, you can move your files securely, verify integrity, and reduce downtime.


Create your free ftpGrid account and make your next migration the last one you’ll ever manage yourself.



Signup now
© 2025 ftpGrid

ftpGrid ApS
Branebjerg 24
DK-5471
Gamby
Denmark

Looking for an all-in-one time tracking, timesheet, and invoicing solution - visit our sister company Nureti at https://nureti.com.