0Pricing
Cloud & IT Cert Prep · Lesson

Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP

Understand why cleartext protocols like Telnet, FTP, and HTTP expose credentials and how their encrypted replacements (SSH, SFTP, HTTPS) solve these problems.

Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Problem with Cleartext Protocols

Many foundational internet protocols were designed in the 1970s and 1980s when security was not a primary concern. Cleartext protocols transmit all data — including usernames, passwords, and sensitive information — in plaintext over the network. Any device on the same network segment, or any system the packets traverse, can capture and read this traffic with freely available tools like Wireshark. In environments with network switches (which normally isolate traffic between ports), ARP spoofing can redirect traffic to an attacker's system, making cleartext protocols dangerous even on 'internal' networks.

# What an attacker sees on the wire with Telnet
# (captured via Wireshark or tcpdump)

tcpdump -i eth0 -A port 23

# Sample Telnet capture output:
..login: admin..
..password: S3cr3tPa$$...
..$ ls -la /etc/passwd..

# Every keystroke is visible in plaintext
# Credentials, commands, and file contents - all exposed

Telnet vs SSH

Telnet (TCP port 23) provides remote command-line access to systems but transmits everything in plaintext. It has no built-in authentication beyond username/password, which are sent unencrypted. SSH (Secure Shell) (TCP port 22) replaces Telnet with an encrypted, authenticated channel. SSH uses asymmetric key exchange to establish a session key, then encrypts all subsequent communication with symmetric encryption. SSH also authenticates the server (preventing server impersonation) and supports public key authentication (passwordless but more secure than passwords) in addition to password authentication.

# SSH connection (encrypted, server authenticated)
ssh admin@192.168.1.10

# SSH key-based authentication (no password)
ssh -i ~/.ssh/id_rsa admin@192.168.1.10

# Generate SSH key pair
ssh-keygen -t ed25519 -C 'admin@company.com'

# Copy public key to server
ssh-copy-id -i ~/.ssh/id_rsa.pub admin@192.168.1.10

# Disable Telnet on network devices (Cisco IOS)
no service telnet
line vty 0 4
  transport input ssh
  login local

SSH Key Exchange and Authentication

SSH's security relies on a robust key exchange process. When connecting, the client verifies the server's host key against a locally stored copy — this prevents server impersonation. If the host key changes unexpectedly, SSH warns the user (a common sign of a man-in-the-middle attack). After verifying the server, client authentication can use: password (encrypted in transit, susceptible to brute force), public key (client proves possession of the private key; much stronger), or keyboard-interactive (supports MFA). Organizations should enforce key-based authentication and disable password authentication on internet-facing SSH services.

# Harden SSH server configuration
# /etc/ssh/sshd_config
Port 22
PermitRootLogin no
PasswordAuthentication no    # Require key auth only
ChallengeResponseAuthentication no
MaxAuthTries 3
AllowUsers admin deploy
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
ClientAliveInterval 300      # Disconnect idle sessions
ClientAliveCountMax 0

# Restart SSH after changes
systemctl restart sshd

FTP vs SFTP and FTPS

FTP (File Transfer Protocol) (TCP ports 20/21) transfers files in plaintext — credentials, commands, and file data are all exposed. FTP also uses a separate data channel (passive or active mode) that complicates firewall rules. SFTP (SSH File Transfer Protocol) tunnels file transfer over SSH on port 22 — completely different from FTP, just sharing a similar name. FTPS (FTP Secure) adds TLS encryption to the original FTP protocol. SFTP is generally preferred because it uses a single port and inherits SSH's authentication and encryption. FTP should be disabled on all production systems.

# SFTP usage (over SSH, single connection)
sftp admin@fileserver.company.com
sftp> put localfile.zip /uploads/
sftp> get /reports/monthly.pdf .
sftp> ls /uploads/
sftp> exit

# Automated SFTP transfer with key auth
sftp -i ~/.ssh/id_rsa admin@fileserver.company.com <<EOF
put /tmp/report.csv /incoming/
EOF

# Disable FTP on Linux (remove vsftpd)
apt purge vsftpd
# Verify no FTP listener:
ss -tlnp | grep ':21'

HTTP vs HTTPS

HTTP (TCP port 80) transmits web content including form data, session cookies, and authentication tokens in plaintext. HTTPS (TCP port 443) wraps HTTP in TLS, providing encryption, server authentication, and data integrity. Organizations should enforce HTTPS everywhere: redirect all HTTP traffic to HTTPS (301 redirect), implement HSTS to prevent browsers from connecting via HTTP, and configure secure and HttpOnly cookie flags to prevent session tokens from being stolen via HTTP or JavaScript. Modern browsers mark HTTP sites as 'Not Secure' — HTTPS is now the baseline expectation for all web services.

# nginx: force HTTPS redirect
server {
  listen 80;
  server_name example.com;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  ssl_certificate /etc/ssl/example.crt;
  ssl_certificate_key /etc/ssl/example.key;
  add_header Strict-Transport-Security
    'max-age=31536000; includeSubDomains; preload';
  add_header X-Content-Type-Options nosniff;
  add_header X-Frame-Options SAMEORIGIN;
}

SNMP v1/v2 vs SNMPv3

SNMP (Simple Network Management Protocol) manages network devices and servers. SNMPv1 and v2c use community strings (essentially shared passwords) sent in cleartext — community strings like 'public' (read) and 'private' (write) are default values that attackers know. An attacker capturing SNMP traffic learns the community string and can read device configurations or change device settings. SNMPv3 adds authentication (HMAC-MD5 or HMAC-SHA) and encryption (AES) with per-user credentials, making it the only version appropriate for production environments. SNMPv1/v2c should be disabled.

# SNMPv3 configuration (Cisco IOS)
snmp-server group MYGROUP v3 priv
snmp-server user MONITORUSER MYGROUP v3 \
  auth sha MyAuthP@ss priv aes 128 MyPrivP@ss

# SNMPv3 query from monitoring server
snmpwalk -v3 -l authPriv \
  -u MONITORUSER \
  -a SHA -A MyAuthP@ss \
  -x AES -X MyPrivP@ss \
  192.168.1.1 sysDescr

# Disable SNMPv1/v2c:
no snmp-server community public ro
no snmp-server community private rw

LDAP vs LDAPS

LDAP (Lightweight Directory Access Protocol) (TCP port 389) authenticates and queries directory services (Active Directory, OpenLDAP) in cleartext by default, exposing credentials and directory data. LDAPS (LDAP over SSL/TLS, TCP port 636) encrypts the connection using a certificate. StartTLS is an alternative that upgrades an existing LDAP connection to TLS using the same port 389. Both LDAPS and StartTLS provide encryption, but LDAPS is generally simpler and more reliable. Organizations should configure all LDAP-consuming applications to use LDAPS and block plaintext LDAP on port 389 at the firewall.

POP3/IMAP vs Encrypted Email Retrieval

Legacy email clients retrieve email using POP3 (port 110) and IMAP (port 143) in cleartext. Encrypted alternatives: POP3S (port 995, TLS) and IMAPS (port 993, TLS). Modern email platforms (Exchange Online, Google Workspace) enforce TLS for all client connections and support OAuth 2.0 token-based authentication instead of passwords. Organizations should disable basic authentication on email protocols — requiring modern authentication (OAuth 2.0 + MFA) prevents credential stuffing attacks that exploit the cleartext authentication mechanisms of legacy email protocols.

# Protocol port reference card
Protocol    Insecure Port  Secure Port  Replacement
---------   ------------   ----------  -----------
Telnet      23             22           SSH
FTP         20/21          22           SFTP
HTTP        80             443          HTTPS
SMTP        25             587/465      SMTPS
POP3        110            995          POP3S
IMAP        143            993          IMAPS
LDAP        389            636          LDAPS
SNMP        161/162        161/162      SNMPv3
RDP         3389           3389         RDP+NLA+TLS

Protocol Replacement in Practice

Replacing insecure protocols requires more than just enabling the secure version — the insecure version must be actively disabled. Steps: audit existing protocol usage (Nmap scans, firewall logs), migrate applications and configurations to the secure protocol, test thoroughly (business applications may break), then block the insecure protocol at the firewall and on the host. Common gotchas: legacy printers and embedded devices often only support FTP or SNMPv2; legacy industrial systems may depend on Telnet. These require network isolation or vendor replacement rather than simple protocol upgrade.

# Audit for insecure protocol usage
# Nmap: find all Telnet listeners on network
nmap -p 23 10.0.0.0/24 --open -sV

# Find FTP listeners
nmap -p 21 10.0.0.0/24 --open

# Find HTTP (not HTTPS) web services
nmap -p 80 --open 10.0.0.0/24

# Check for SNMPv1/v2c community strings
nmap -sU -p 161 --script snmp-info 10.0.0.0/24

# Block Telnet at firewall after migration
iptables -A FORWARD -p tcp --dport 23 -j DROP
iptables -A INPUT -p tcp --dport 23 -j DROP

Remote Desktop Protocol Security

RDP (Remote Desktop Protocol) (port 3389) is widely used for remote Windows administration and is a major attack target. Insecure RDP configurations include: exposing port 3389 to the internet, using password-only authentication, and disabling NLA. Hardening RDP: enable Network Level Authentication (NLA) which authenticates before the full session opens (blocking unauthenticated connections); require TLS 1.2+ for all RDP sessions; put RDP behind a VPN or RDP gateway rather than exposing it to the internet; and enforce account lockout to prevent brute force. Many ransomware campaigns gain initial access via exposed, poorly secured RDP.

Deprecating Insecure Protocols in Stages

Migrating away from insecure protocols in production environments requires careful planning to avoid business disruption. A phased approach: Phase 1 — Discover: run Nmap scans and audit firewall logs to identify all uses of cleartext protocols. Phase 2 — Enable secure alternatives: configure SSH, SFTP, HTTPS alongside the existing insecure services. Phase 3 — Migrate consumers: update scripts, applications, monitoring tools, and user workflows to use the secure protocol. Phase 4 — Disable and block: disable the insecure service on each host and block the port at the firewall. Testing at each phase prevents production outages.

# Phase 4: Disable and block Telnet permanently

# Disable Telnet service on Linux
systemctl stop telnet.socket
systemctl disable telnet.socket

# Block Telnet at iptables
iptables -A INPUT -p tcp --dport 23 -j DROP
iptables -A OUTPUT -p tcp --dport 23 -j DROP
# Save rules
iptables-save > /etc/iptables/rules.v4

# Block at network firewall (Cisco ASA)
access-list OUTSIDE_IN deny tcp any any eq 23

# Verify: should timeout / connection refused
nc -zv 192.168.1.10 23

Quick Check

Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.

Lesson Recap

In this lesson you learned: cleartext protocols (Telnet, FTP, HTTP, SNMPv1/v2c, LDAP) expose credentials and data to network eavesdropping and must be replaced, secure replacements (SSH, SFTP, HTTPS, SNMPv3, LDAPS) use TLS or SSH encryption to protect the same functionality, and replacing protocols requires disabling the insecure version at the firewall and host level after auditing for legacy dependencies. Next up we explore TLS versions, cipher suites, and perfect forward secrecy.

Frequently asked questions

Is the “Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP” lesson free?

Yes — the full text of “Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP”?

Understand why cleartext protocols like Telnet, FTP, and HTTP expose credentials and how their encrypted replacements (SSH, SFTP, HTTPS) solve these problems. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Replacing Insecure Protocols: Telnet vs SSH, FTP vs SFTP
  2. TLS Versions, Cipher Suites, and Perfect Forward Secrecy
  3. Secure DNS: DNSSEC and DNS over HTTPS (DoH)
  4. IPsec, VPN Protocols, and Remote Access Security
← Back to Cloud & IT Cert Prep