# Connecting with FTP clients

This page is for the people who connect: which settings an FTP program needs for a CrushMFT server. For the server's side, see [FTP, FTPS and FTPES ports](Ports-FTP.md).

## What to ask the administrator

| You need | Example |
|---|---|
| the host name | `files.example.com` |
| the port | 21 for FTP with or without TLS, 990 for implicit FTPS |
| which encryption | "explicit TLS" in almost every case |
| your user name and password | |

If the server offers SFTP as well, prefer it: one port, nothing to set up in firewalls. See [Connecting with SFTP clients](Connect-SFTP.md).

## The settings, in any program

| Setting | Choose |
|---|---|
| protocol | FTP |
| encryption | **Require explicit FTP over TLS**. Programs call it "FTPES", "explicit TLS", "AUTH TLS" or "FTP with TLS/SSL". Choose "implicit" only for a server on port 990. |
| transfer mode | **Passive**. It is the default nearly everywhere. |
| transfer type | **Binary**, or "auto". Never "ASCII" for everything: it damages every file that is not plain text. |
| character set | UTF-8 |
| simultaneous connections | 2 to 4. More does not make it faster and may hit the server's limit of logins per user. |

At the first connection the program shows the server's certificate. For a certificate of a known authority there is nothing to do. For one the program does not know, compare its fingerprint with what the administrator gives you before you accept it.

## Common programs

**FileZilla.** File › Site Manager › New site. Protocol: "FTP - File Transfer Protocol". Encryption: "Require explicit FTP over TLS". Logon Type: "Normal", with user and password. On the tab Transfer Settings, leave the mode on "Default" or choose "Passive".

**WinSCP.** New Site. File protocol: "FTP". Encryption: "TLS/SSL Explicit encryption". Host name, port 21, user name, password.

**Cyberduck.** Open Connection, and choose "FTP-SSL (Explicit AUTH TLS)".

**The command line**, with curl, which is on most systems:

```
curl --ssl-reqd --user alex ftp://files.example.com/
curl --ssl-reqd --user alex -T report.pdf ftp://files.example.com/Incoming/
curl --ssl-reqd --user alex -O ftp://files.example.com/Reports/q3.pdf
```

`--ssl-reqd` demands encryption and gives up without it. curl asks for the password; do not write it into the command.

The old `ftp` command of Windows cannot encrypt and cannot use passive mode properly. Do not use it.

## In scripts

- Use a client that can demand TLS and check the certificate, such as curl or lftp.
- Check the result of every transfer. A script that does not notice a failed upload is worse than no script.
- Upload under a temporary name and rename at the end, or ask the administrator to give uploads in progress an ending of their own, so that nothing picks up half a file.
- Keep the password out of the script: in a file only the script's account can read.

## When it does not work

| What you see | Usually |
|---|---|
| it connects and logs in, then the listing hangs or times out | passive mode is not getting through: the server's passive ports are not open, or the server names an address you cannot reach. This is the server's side: tell the administrator. Trying "active" mode sometimes works as a stopgap from networks without a firewall. |
| "530" at login | name or password; or the account may not use FTP; or the server demands TLS and the program is set to plain |
| "TLS required", "550 SSL/TLS required" | set the encryption to explicit TLS |
| the certificate is refused | the name you typed is not the name in the certificate; or the certificate is not from a known authority |
| names with wrong letters | set the character set to UTF-8 |
| files arrive damaged | the transfer type is ASCII: set it to binary |
| "too many connections" | lower the number of simultaneous connections in the program |

A message "Quota space available" with each transfer is not an error: the server tells you how much room you have.
