What FTP Is
FTP, the File Transfer Protocol, is one of the oldest internet protocols; its current definition, RFC 959, dates from 1985. A client program on your own computer connects to an FTP server to list folders, upload and download files, and rename or delete them. FTP has no encryption of its own: user names, passwords, and file contents cross the network as plain text. Two newer protocols do the same job securely: FTPS, which adds TLS to FTP, and SFTP, a separate protocol that runs over SSH.
How an FTP Session Works
- Control connection on port 21: the client connects to TCP port 21 and sends text commands such as USER and PASS to log in, LIST for a folder listing, RETR to download, and STOR to upload. The server answers each with a three-digit code, such as 230 after a successful login.
- Data connections: every listing and every file travels over a separate, new TCP connection. How that connection is opened depends on the mode.
This two-connection design is why FTP is awkward with firewalls and NAT routers. The port numbers are also listed in common port numbers.
Active and Passive Mode
| Mode | Data connection opened by | Server port |
|---|---|---|
| Active | The server, toward the client | 20 |
| Passive | The client, toward the server | A high port |
In active mode the client sends a PORT command naming an address and port, and the server connects back to it from port 20. Most clients sit behind NAT or a firewall that blocks such incoming connections, so active mode often fails. In passive mode the client sends PASV or EPSV, the server answers with a port number, and the client opens the data connection itself. Current clients use passive mode by default. On the server side this means a range of high ports must be open in the firewall in addition to port 21.
Plain Text Passwords
Because plain FTP is unencrypted, anyone on the path between client and server, such as the operator of a shared network or an attacker on a compromised router, can capture the login and reuse it. Often the same password also opens other services on the server. Plain FTP should not be used over the internet for anything that needs a login.
FTPS: FTP with TLS
FTPS keeps the FTP commands and the two kinds of connection and wraps them in TLS, the encryption HTTPS uses. Explicit FTPS connects to port 21 and switches to TLS with the AUTH TLS command. Implicit FTPS, an older form, starts with TLS right away on port 990. FTPS needs a certificate on the server and still needs the passive port range in the firewall.
FTP, FTPS, and SFTP Compared
| Protocol | Encryption | Ports |
|---|---|---|
| FTP | None | 21 plus data ports |
| FTPS | TLS | 21 or 990 plus data ports |
| SFTP | SSH | 22 only |
Despite the name, SFTP is not FTP over SSH: it is its own protocol, built into the SSH server, and shares no commands with FTP.
Why SFTP Is the Usual Choice on a VPS
- Nothing to install: the SSH server on a Linux VPS already provides SFTP.
- One port: port 22, or your custom SSH port, and no passive range.
- Keys: you can log in with an SSH key instead of a password.
- System accounts: SFTP users are normal users with normal permissions, and one can be confined to a single folder.
Any client on your own computer that supports SFTP connects with the server address, port, user name, and key. On the command line, see how to use SFTP, and for single copies how to use scp.
If You Must Run an FTP Server
Some devices and older systems speak only FTP. Then run an FTP server such as vsftpd with TLS required and a fixed passive range. In /etc/vsftpd.conf on Ubuntu and Debian, or /etc/vsftpd/vsftpd.conf on AlmaLinux and Rocky Linux:
ssl_enable=YES
force_local_logins_ssl=YES
force_local_data_ssl=YES
rsa_cert_file=/etc/letsencrypt/live/example.com/fullchain.pem
rsa_private_key_file=/etc/letsencrypt/live/example.com/privkey.pem
pasv_min_port=40000
pasv_max_port=40100Restart the service. If you work over SSH, keep SSH allowed and your session open before you touch the firewall. Then open port 21 and the passive range, for example on Ubuntu and Debian with sudo ufw allow 21/tcp and sudo ufw allow 40000:40100/tcp. Where you can, allow only the addresses that need it.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations