Port 22
Port 22 Secure Shell
SSH listens on port 22 on almost every server and many network devices. Every exposed one receives login attempts within minutes.
What is port 22 used for?
Port 22 is the standard port of SSH (Secure Shell), the encrypted remote login used to run Linux and Unix servers, network devices and many appliances. File transfer over SFTP and SCP runs on it too.
Unlike the other services on these pages, SSH often needs to be reachable from the internet, and with the right settings it can be.
Why attackers want it
A server with password login and a weak password falls to guessing. Once in, attackers install their own key so they keep access, start cryptocurrency miners, and add the server to a botnet that scans for the next one.
Who scans port 22
Every address that scanned port 22 from 28 October to 27 November 2026, with known scanners left out.
- AS14061DigitalOcean, LLC 4.841
- AS4134Chinanet 1.313
- AS8075Microsoft Corporation 1.165
- AS14618Amazon.com, Inc. 953
- AS135377UCLOUD INFORMATION TECHNOLOGY (HK) LIMITED 830
- AS22773Cox Communications Inc. 796
- AS45090Shenzhen Tencent Computer Systems Company Limited 730
- AS4766Korea Telecom 652
- AS45102Alibaba (US) Technology Co., Ltd. 651
- AS37963Hangzhou Alibaba Advertising Co.,Ltd. 539
- United States of America 10.690
- People's Republic of China 5.443
- Germany 1.849
- India 1.731
- Hong Kong 1.604
- Brazil 1.348
- United Kingdom 1.265
- Netherlands 1.192
- South Korea 918
- Vietnam 820
Should port 22 be open?
Port 22 can be open when it has to be, but only with key based login, no password login and no direct root login. Better still, allow it only from the addresses that need it, or reach it through a VPN.
Use keys, not passwords
Turn off password authentication and direct root login, and check authorized_keys for keys you did not add.
Limit who can connect
Allow port 22 only from known addresses or through a VPN, and rate limit new connections.
Keep OpenSSH current
Update OpenSSH and the system it runs on. regreSSHion (CVE-2024-6387) was fixed in OpenSSH 9.8p1.
Port 22 questions
What is port 22 used for?
Port 22 is the standard port of SSH, the encrypted remote login for servers and network devices. SFTP and SCP file transfers use it too.
Is it safe to have port 22 open?
It can be, with key based login only, password login and root login turned off, and the software kept up to date. Limiting it to known addresses or a VPN is safer still.
Should I move SSH to another port?
A different port cuts the noise in your logs but not the risk. Scanners find SSH on any port. Keys, no password login and blocking known attackers are what protect it.
How do I block attacks on port 22?
Allow SSH only from the addresses that need it, rate limit new connections, and block the addresses that scan for SSH with an IP blocklist before they reach the server.
Block the sources that scan port 22.
An hourly IP feed of active scanners keeps them away from this port and everything else you run.