A security and architectural comparison explaining why cleartext protocols were deprecated, packet sniffing vulnerabilities, Active vs Passive FTP modes, and secure encrypted alternatives.
During the early decades of the ARPANET and nascent Internet, protocols were engineered under the assumption that connected computer hosts were operated by trusted academic or government researchers. Two foundational protocols born in that era were Telnet (RFC 854, 1983) for remote terminal login and FTP (File Transfer Protocol, RFC 959, 1985) for transferring files.
However, both protocols suffer from a fatal security vulnerability: they transmit all authentication credentials, usernames, passwords, and session data across the network in unencrypted cleartext. In this masterclass, we examine why modern security standards prohibit Telnet and plain FTP in production, how packet sniffers harvest plaintext credentials, and how to utilize encrypted modern standards: SSH (Secure Shell), SFTP, and FTPS.
When an administrator logs into a server using Telnet (TCP port 23) or logs into an FTP server (TCP port 21), every keystroke and packet payload travels across the network in ASCII plaintext. Any adversary connected to the same local switch, public Wi-Fi network, or intermediate router can capture the root credentials in real time using tcpdump:
# Capturing cleartext FTP passwords on port 21 using tcpdump
sudo tcpdump -i eth0 -A 'tcp port 21' | grep -iE 'USER|PASS'
# Example real sniffed output on an unencrypted FTP session:
# USER admin
# PASS SuperSecretPassword2026!
Because there is no cryptographic signature or SSL/TLS tunnel, attackers can perform Man-in-the-Middle (MITM) attacks, eavesdrop on private intellectual property, and hijack active sessions.
| Legacy Protocol (Deprecated) | Default Port | Modern Replacement (Standard) | Secure Port | Cryptographic & Operational Advantage |
|---|---|---|---|---|
| Telnet | 23 (TCP) |
SSH (Secure Shell) | 22 (TCP) |
SSH uses public-key cryptography (Ed25519/RSA), Diffie-Hellman key exchange, and AES-GCM symmetric encryption for entire terminal sessions. |
| FTP (Plain) | 21 (Control) |
SFTP (SSH File Transfer) | 22 (TCP) |
Runs completely inside the existing encrypted SSH tunnel. Operates on a single port (firewall friendly) with complete packet integrity verification. |
| FTP (Plain) | 21 (Control) |
FTPS (FTP over SSL/TLS) | 21 / 990 |
Wraps traditional FTP in TLS certificates. Useful for legacy enterprise compliance requiring classic FTP command sets. |
| rsh / rlogin / rcp | 513 / 514 |
SSH / SCP / Rsync | 22 (TCP) |
Legacy Berkeley 'r-commands' relied solely on IP address trusting (/etc/hosts.equiv), allowing trivial IP spoofing. Completely replaced by SSH/Rsync. |
While nobody uses Telnet for remote administration today, the Telnet client binary remains a lightweight tool to test whether a remote TCP port is alive and accepting connections without needing a full application client:
# 1. Test if a remote web server is listening on port 80
telnet example.com 80
# Output: Connected to example.com.
# Escape character is '^]'.
# 2. Test if a remote mail server is listening on SMTP port 25
telnet mail.example.com 25
# Type: QUIT to disconnect
# 3. Modern superior diagnostic tool: Netcat (nc)
nc -zvw3 example.com 80
# Output: Connection to example.com 80 port [tcp/http] succeeded!
Unlike modern protocols that operate over a single TCP connection, FTP uses two separate connections: a Control Connection (Port 21) for commands and authentication, and a Data Connection for moving file contents and directory listings:
PORT command telling the server: "Connect to my port $N+1$".PASV command requesting a passive connection.The SSH File Transfer Protocol (SFTP) is built into OpenSSH. If your server allows SSH logins, SFTP is already installed and fully operational without configuring additional daemons:
# 1. Connect to remote server using SFTP
sftp username@192.168.1.100
# 2. Inside the interactive SFTP prompt:
sftp> pwd # Print working directory on remote server
sftp> lpwd # Print local working directory on your client machine
sftp> ls # List remote files
sftp> lls # List local files
sftp> put report.pdf # Upload local file to remote server
sftp> get database_dump.sql # Download remote file to local machine
sftp> exit # Disconnect
For synchronization and production backups, rsync utilizes SSH encryption with differential delta transfers:
# Sync local website folder to remote server securely over SSH
rsync -avz -e ssh /var/www/html/ user@192.168.1.100:/var/www/html/
If an enterprise legacy system strictly mandates an FTP service, you must secure it using vsftpd (Very Secure FTP Daemon) enforced with TLS encryption:
# 1. Install vsftpd
sudo apt install vsftpd -y # Ubuntu/Debian
# sudo dnf install vsftpd -y # RHEL/Rocky
# 2. Generate a self-signed TLS/SSL Certificate
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/vsftpd.key \
-out /etc/ssl/certs/vsftpd.crt
# 3. Configure vsftpd to mandate TLS encryption
sudo nano /etc/vsftpd.conf
Append the following hardening parameters to /etc/vsftpd.conf:
# Enable SSL/TLS encryption
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1_2=YES
ssl_tlsv1_3=YES
# Certificate paths
rsa_cert_file=/etc/ssl/certs/vsftpd.crt
rsa_private_key_file=/etc/ssl/private/vsftpd.key
# Passive mode port range (open these in your firewall!)
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
# 4. Restart the service and verify
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd
# 1. Connect to FTPS using an SSL/TLS aware client like curl
curl --insecure --ssl-reqd --user "username:password" ftp://192.168.1.100/
# 2. Verify that plain unencrypted connections are rejected:
ftp 192.168.1.100
# Output: 530 Non-anonymous sessions must use encryption.
telnet host port) to verify if a remote port is listening, although even this function is increasingly handled by nc (Netcat) or curl.
vsftpd. By enforcing TLS v1.2/v1.3 encryption on both control and data streams (force_local_logins_ssl=YES and force_local_data_ssl=YES), authentication credentials and transferred files remain protected against eavesdropping.