Skip to content
AdminKit

Is port 22 (SSH) exposed to the internet, and does that matter?

Port 22 is the default port for SSH, used for encrypted remote administration of servers and network devices. CISA has warned that any internet-reachable SSH service draws automated scanning and brute-force login attempts within minutes of going online. Port 22 isn't on AdminKit's port-check tool's current nine-port list, so this guide shows how to confirm your own exposure manually.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • SSH on port 22 is encrypted and well designed. The risk of exposing it is the login prompt: anyone on the internet can try passwords against it, and automated scanners do so constantly.
  • OpenSSH accepts passwords by default. Key-only login, no direct root login and a network-level restriction remove most of the risk.
  • The server announces its software and version in its first line, which makes patch status easy to check, for you and for anyone scanning.
  • AdminKit’s port check does not test port 22. Use the manual test on this page from outside your network.

Why does a reachable SSH port draw so much attention?

SSH (Secure Shell) is the standard way to administer Linux servers, network gear and a growing number of embedded devices remotely, and the protocol itself is sound: sessions are encrypted end to end and support both password and public-key authentication. The risk this page is about is narrower than “SSH is insecure” — it’s that port 22 is also one of the most continuously scanned ports on the public internet, precisely because it’s so common. CISA’s ICS-ALERT-12-034-01 describes the pattern directly: attackers “probe a large number of IPs” on port 22, and once a service answers, they move straight into a brute-force attempt — guessing usernames and passwords, sometimes with “hundreds or thousands of login attempts over a relatively short time period,” sometimes more slowly with “only a few careful attempts, then waiting to try again later” to stay under the radar of simple rate-limit detection.

Are SSH’s defaults safe enough to leave on the internet?

Two settings decide how much that exposure actually matters, and both ship more open than it’s reasonable to assume. Per OpenBSD’s own sshd_config manual, PasswordAuthentication defaults to yes — password login is accepted unless an administrator turns it off — and PermitRootLogin defaults to prohibit-password, which still allows the root account to log in directly over SSH using a key, just not a password. Neither default disables the risk CISA describes; they only narrow it. A server that has never had its sshd_config touched is, by the distribution’s own default, still willing to accept password guesses against any account that exists on it, including root on older or differently-packaged systems.

How do you check your own exposure?

AdminKit’s open ports check checks a fixed nine-port list, and port 22 isn’t on it — confirm your current public IP first with what is my IP, then test the port manually from a machine outside your network with nc -vz -w 3 203.0.113.5 22. A connection that succeeds means the port is reachable; “connection refused” or a timeout means it’s closed or filtered. A port that answers doesn’t automatically mean you’re compromised, but it does mean you’re part of the population CISA’s advisory describes as drawing continuous scanning traffic, and it’s worth knowing that before an incident, not after one.

What is usually answering on port 22?

ListenerTypical homeNotes
OpenSSH (sshd)Linux and BSD servers, cloud VMs, macOS with Remote Login on, NAS devicesThe reference implementation; its manual is the source for the defaults above.
OpenSSH for WindowsWindows Server and Windows 10/11 with the optional OpenSSH Server featureSame daemon and configuration file format, stored under C:\ProgramData\ssh\.
DropbearRouters, embedded Linux, small appliancesA compact SSH server with its own options; check the device’s admin panel rather than sshd_config.
Vendor network operating systemsManaged switches, firewalls, wireless controllersManagement-plane SSH; CISA’s guidance on management interfaces applies.

Knowing which one it is matters because the fixes differ. Editing sshd_config does nothing on a router running Dropbear, and a firewall’s management SSH is normally restricted from the vendor’s own management-access settings.

What does the SSH banner tell you?

An SSH server speaks first. RFC 4253, section 4.2 requires both sides to send an identification string of the form SSH-protoversion-softwareversion as soon as the connection opens. That makes the manual check more informative than for most ports. Example output, with a documentation address and an illustrative version string:

$ nc -v -w 3 203.0.113.5 22
Connection to 203.0.113.5 22 port [tcp/ssh] succeeded!
SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13
What you seeMeaning
succeeded and an SSH-2.0-... lineAn SSH server is reachable from the internet, and the line names its software.
succeeded but no SSH- line within a few secondsSomething else is listening on 22, or a proxy is in front. Identify it before assuming it is safe.
Connection refused or a timeoutNot reachable from that vantage point.

The version string is what scanners record too, so an out-of-date server is visible to anyone. In July 2024 the OpenSSH project fixed CVE-2024-6387, a race condition in sshd’s signal handling that could allow unauthenticated remote code execution as root on glibc-based Linux systems; the OpenSSH 9.8 release notes describe it and the affected versions. Nothing in the password-related defaults would have stopped it, because it was reachable before login. That is the strongest argument for the network-level restriction in the fix list below, not only for key-only login.

How do you confirm what your server will actually accept?

Configuration files can include other files and distributions ship their own drop-ins, so reading /etc/ssh/sshd_config is not enough. On an OpenSSH server, sshd -T prints the effective settings after every file has been parsed:

$ sudo sshd -T | grep -Ei '^(port|passwordauthentication|permitrootlogin|kbdinteractiveauthentication|maxauthtries) '
port 22
passwordauthentication yes
permitrootlogin prohibit-password
kbdinteractiveauthentication yes
maxauthtries 6

The output above is an example of an unchanged default configuration. Note kbdinteractiveauthentication: on many systems keyboard-interactive login goes through PAM and still asks for a password, so turning off PasswordAuthentication alone may not stop password prompts. Set both to no when you move to keys. ss -ltnp 'sport = :22' confirms which process holds the port.

To see whether the exposure has been noticed, look at the authentication log (journalctl -u ssh or /var/log/auth.log on Debian and Ubuntu, /var/log/secure on Red Hat family systems). Lines such as Invalid user and Failed password from addresses you do not know are the scanning CISA describes. An Accepted line from such an address is an incident.

What does a successful SSH login give an attacker?

More than a shell. A logged-in SSH user gets a command line with that account’s rights, and by default OpenSSH also lets the session carry other traffic: AllowTcpForwarding defaults to yes in the sshd_config manual. With one guessed password, an attacker can open tunnels from the server to other machines on your internal network, such as a file share, a database or a router’s admin page that was never meant to face the internet. The SSH server becomes a relay into everything it can reach.

That is why a single weak account on an exposed SSH server is a network problem, not just a problem for that machine. If an account only needs file transfer or one command, restrict it with Match blocks and set AllowTcpForwarding no for it.

What about the keys themselves?

Switching to keys moves the risk rather than removing it. Keys get copied between machines, left in old accounts and never rotated. NIST’s IR 7966 on SSH access management covers how to inventory authorized keys, remove the ones nobody owns and limit what automated keys can do. On an exposed server, check every account’s ~/.ssh/authorized_keys as part of the cleanup.

How to fix it

  • Set PasswordAuthentication no in sshd_config and switch every account to key-based authentication, which removes the credential-guessing attack CISA’s advisory describes entirely.
  • Set PermitRootLogin no rather than relying on the prohibit-password default, and use a named account with sudo for administrative access instead.
  • Put SSH behind a VPN, bastion host or an access broker so the login prompt itself isn’t reachable from the open internet, or at minimum restrict the port to known source IP ranges with a firewall rule.
  • Consider CISA’s suggestion of moving SSH off port 22 to a non-standard port — a weak deterrent against a targeted attacker, but it does reduce the baseline scanning noise the advisory describes, which can make real attack attempts easier to spot in logs.
  • Turn on fail2ban or an equivalent intrusion-prevention tool so repeated failed logins from one source trigger a temporary ban, directly addressing the “hundreds or thousands of login attempts” pattern CISA’s advisory flags as the clearest brute-force signal.

None of these steps require replacing SSH — they’re configuration and network-placement changes on top of a protocol that’s already sound, aimed specifically at the gap between “SSH is encrypted” and “this login prompt shouldn’t be reachable by anyone on the internet who wants to try.”

This is the same direct-exposure pattern this site covers for RDP on port 3389: a legitimate remote-access protocol that only becomes a real risk once its login prompt is reachable from anywhere on the internet rather than from a controlled network.

Defensive use only

Every check this page links to is for assets you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to a network or device you don’t control — AdminKit’s active checks only ever run against the IP making the request or an asset you’ve verified ownership of. See our Disclaimer and Acceptable Use Policy for the full terms. SSH joins the other remote-administration and network-service exposure checks in AdminKit’s machine protocols cluster.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

Does AdminKit's port-check tool scan port 22?

No. The tool checks a fixed list of nine specific TCP ports (23, 554, 1883, 8883, 502, 7547, 80, 443, 8080) chosen for how often they turn up misconfigured on home and small-office devices — see the port-check tool page for the current list. 22 isn't on that list, so confirm your own exposure with the manual check below.

Is SSH itself an insecure protocol?

No — SSH encrypts the session and supports strong authentication. The risk this page addresses is a reachable login prompt: once port 22 answers from the open internet, every password or key-based login attempt against it, legitimate or not, happens over the public network instead of a controlled one.

What does CISA actually say about SSH scanning?

CISA's ICS-ALERT-12-034-01 describes attackers probing large ranges of IP addresses on port 22 to find reachable SSH services, then launching brute-force login attempts — it recommends account lockout policies, removing default credentials, and considering a non-standard listening port.

Does disabling password authentication fully fix this?

It removes the single biggest risk — credential guessing — but OpenSSH's own sshd_config still defaults PasswordAuthentication to yes and PermitRootLogin to prohibit-password (key-only root login, not disabled root login), so both need an explicit administrator change, not just a default you can assume is already safe.

What's the fastest fix if my own port 22 is reachable and shouldn't be?

Put SSH access behind a VPN or bastion host instead of forwarding it directly, switch to key-based authentication with PasswordAuthentication set to no, and restrict the port to known source IP ranges with a firewall rule.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.