Toolman

Port 22 — SSH / SFTP

TCP well-known

What runs on port 22

Secure Shell — remote terminal access, and the transport for SFTP and SCP. Also what Git uses over SSH.

Security considerations

The single most brute-forced port on the internet. Disable password authentication, use keys only, and consider fail2ban. Moving to a non-standard port reduces log noise but is not security.

Checking whether something is listening

# Linux / macOS — what is bound to the port
sudo lsof -i :22
sudo ss -lntp | grep :22

# Windows
netstat -ano | findstr :22
Get-NetTCPConnection -LocalPort 22

# is it reachable from outside?
nc -zv example.com 22
curl -v telnet://example.com:22

Freeing the port

# find the process, then stop it
sudo lsof -ti :22 | xargs kill        # Linux / macOS
netstat -ano | findstr :22            # note the PID, then:
taskkill /PID <pid> /F                    # Windows

Should this port be open to the internet?

Only with care. SSH is designed to be exposed, but it is also the most brute-forced port on the internet. Keys only, no password authentication, and rate limiting.

Quick reference

Port22
ProtocolTCP
ServiceSSH / SFTP
RangeWell-known (0–1023) — binding requires root on Unix

Frequently asked questions

What is port 22 used for?

Secure Shell — remote terminal access, and the transport for SFTP and SCP. Also what Git uses over SSH.

Is it safe to open port 22?

The single most brute-forced port on the internet. Disable password authentication, use keys only, and consider fail2ban. Moving to a non-standard port reduces log noise but is not security.

How do I check if port 22 is open?

Locally, sudo lsof -i :22 on macOS or Linux, or netstat -ano | findstr :22 on Windows. From outside, nc -zv host 22 tells you whether anything answers.

Why do I get "address already in use" on port 22?

Another process is bound to it — often a previous run of your own program that did not exit cleanly. Find it with lsof -ti :22 and stop it, or configure your application to use a different port.

Can I change the port this service uses?

Almost always yes, in the service's configuration. Moving off a default port reduces automated scan noise, but it is obfuscation rather than security — a real attacker scans all 65,535.

Other common ports

All port numbers