What is port 22 used for?
Port 22 is where an SSH server listens. SSH gives an encrypted remote command line on servers and network devices, and the same connection carries file transfers (SFTP and SCP) and tunnelled traffic.
SSH replaced Telnet for device administration because it encrypts the whole session, including the sign-in. The server proves its identity with a host key, which the client remembers; a warning that the host key has changed can mean a rebuilt server or someone in the middle. Users sign in with a password or, better, a key pair. Because 22 is the well-known port, an SSH server exposed to the internet receives constant automated password guessing, which is why key-based sign-in and restricting who can reach the port are standard hardening.
Is port 22 TCP or UDP?
TCP. RFC 4253 says an SSH server normally listens for TCP connections on port 22. IANA registers 22 for UDP as well, but SSH itself runs over TCP.
Is port 22 secure?
The protocol is: SSH encrypts everything and is the secure choice for remote administration. The exposure is the risk. A port 22 open to the whole internet with password sign-in will be attacked by guessing, so use keys, limit the source addresses and disable direct root sign-in.
Port 22 vs port 23: what is the difference?
Both give a remote command line. Port 23 is Telnet, which sends everything, passwords included, in clear text. Port 22 is SSH, which encrypts the session. When a question asks for secure remote administration of a device, 22 is the answer. Port 23 explained
Which CompTIA exams list port 22?
CompTIA lists port 22 by number in both the Network+ and the A+ Core 1 objectives.
- Network+ N10-009: objective 1.4 (Networking Concepts), listed as “Secure Shell (SSH), 22, and Secure File Transfer Protocol (SFTP), 22”.
- A+ Core 1 220-1201: objective 2.1 (Networking), listed as “22, Secure Shell (SSH)”.
The quoted text is how the objectives document lists the port. The exam puts the port in a scenario, such as a firewall rule or a failed connection; it does not only ask for the number.
Check yourself: a practice question
Written by CertSprint for this page. It is not taken from any exam.
An administrator must copy a configuration file to a router over an encrypted connection, and only TCP 22 is open. Which protocol can be used?
- SFTP
- TFTP
- FTP
- Telnet
Show the answer
A. SFTP. SFTP runs inside SSH on port 22. TFTP uses UDP 69, FTP uses ports 20 and 21, and Telnet transfers no files and encrypts nothing.
Sources: IANA Service Name and Transport Protocol Port Number Registry: port 22; RFC 4253: The Secure Shell (SSH) Transport Layer Protocol; RFC 4251: The Secure Shell (SSH) Protocol Architecture. The port number and how each exam lists it come from CompTIA's exam objectives, linked from the study plans above. The explanation and the question are CertSprint's own, checked against these sources on 12 November 2026.