# The FTP proxy

An old FTP server, with years of accounts and folders, cannot be replaced overnight. It also should not stay on the internet: FTP sends every password in the clear. CrushMFT can stand in front of it. People connect to CrushMFT with SFTP, FTPS or HTTPS; CrushMFT logs in to the old server for them, with their own name and password, and passes everything through.

The old server keeps its users, its rights and its files. Nothing is copied, and nobody is migrated.

## How it works

It is a use of the [VFS](VFS.md), not a special feature: a user's folder that points at an [FTP server](VFS-FTP.md), with the user's own login in the address. One template user serves everybody.

## Setting it up

1. **Move the old server out of the way.** Change its port from 21 to another, such as 2121, and close that port to the outside. Only CrushMFT needs to reach it.
2. **Make a user named `template`** in the [User Manager](Users.md).
3. **Give it a remote item**: in [the VFS editor](Users-Setup-VFS-Editor.md), **New Remote Item**, item type **FTP**.

   | Field | Enter |
   |---|---|
   | **Name** | such as `ftp` |
   | **URL** | `FTP://127.0.0.1:2121/`, or the address of the old server |
   | **User name** | `{username}` |
   | **Password** | `{password}` |

4. **Give the item all permissions**: download, upload, view, delete, rename, create and delete folder, resume. The old server decides what each user may really do; CrushMFT should not narrow it.
5. **Save.**
6. **Offer the secure protocols**: listeners for [SFTP](Ports-SFTP.md), [HTTPS](Ports-HTTP.md), and [FTP with required encryption](Ports-FTP.md), in [IP / Servers](Ports.md).

## What happens at a login

Somebody logs in to CrushMFT as `joe`. CrushMFT has no user `joe`, so it takes the settings of the user `template`, puts `joe` and the password that was typed into the item's address, and tries them on the old server. If the old server lets `joe` in, the login is good, and `joe` sees what the old server shows him.

Users can so use SFTP, a browser, or FTPS today, with the accounts they have always had.

The user `template` is what CrushMFT falls back on for a name it does not know. With no such user, an unknown name is simply refused.

## Protocol conversion in general

The same works with any type of storage in place of the FTP server: an [SFTP server](VFS-SFTP.md), a [WebDAV server](VFS-WebDAV.md), an [SMB share](VFS-SMB.md) with the users' Windows logins. And it works for single users: a user of CrushMFT's own, with a folder on the old server under a fixed login.

## Moving away, later

With CrushMFT in front, the old server can be emptied at your pace:

1. Make real CrushMFT users, group by group, with folders on new storage.
2. A user who exists in CrushMFT is no longer taken from the template.
3. When nobody is left, turn the old server off.

## Things to know

- Every password still travels in the clear between CrushMFT and the old server. Keep the two on one machine, or on a network nobody else is on. If the old server can do FTPES, use the item type **FTPES**.
- The old server sees every connection as coming from CrushMFT. Rules by address on the old server no longer tell users apart; put them on CrushMFT.
- A wrong password is a failed login on **both** servers. Lock-out rules on the old one can lock an account after a few mistyped tries at CrushMFT.
- Limits, events and logs of CrushMFT apply to these users through the template: what is set on `template` holds for all of them.
