All ports

Port22/TCP

ssh

Port

22

Protocol

TCP

Category

Well-Known

Service

ssh

What is port 22?

Port 22/TCP is a Well-Known port, assigned by IANA for widely recognized services. It is associated with the ssh service.

The Secure Shell (SSH) Protocol

Useful commands

nmapnmap -p 22 -sV example.com
netcatnc -zv example.com 22
curlcurl -v http://example.com:22/
telnettelnet example.com 22
bash(echo > /dev/tcp/example.com/22) 2>/dev/null

Firewall commands

UFWAllow
sudo ufw allow 22/tcp
Deny
sudo ufw deny 22/tcp
iptablesAllow
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Deny
sudo iptables -D INPUT -p tcp --dport 22 -j ACCEPT
firewalldAllow
sudo firewall-cmd --permanent --add-port=22/tcp
WindowsAllow
netsh advfirewall firewall add rule name="Open Port 22" dir=in action=allow protocol=TCP localport=22

Security Risks

  • Unauthorized remote access to the server
  • Brute force attacks against SSH credentials
  • Exposure of private keys or misconfigurations
  • Outdated versions with known vulnerabilities

Frequently Asked Questions

What service runs on port 22/TCP?

Port 22/TCP is associated with the ssh service. The Secure Shell (SSH) Protocol

Is it safe to expose port 22 to the Internet?

It depends on the service and configuration. Port 22 (ssh) is a Well-Known port. If you need to expose it, keep the service updated, use strong authentication, and configure a firewall. It's always recommended to restrict access by IP when possible.

How do I check if port 22 is open?

You can use nmap: `nmap -p 22 -sV example.com`, netcat: `nc -zv example.com 22`, or the bash command: `(echo > /dev/tcp/example.com/22) 2>/dev/null && echo "Open" || echo "Closed"`.

How do I open or close port 22 on my firewall?

On Linux with UFW: `sudo ufw allow 22/tcp` (open) or `sudo ufw deny 22/tcp` (close). With iptables: `sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT`. On Windows: `netsh advfirewall firewall add rule name="Open Port 22" dir=in action=allow protocol=TCP localport=22`.

What applications and services use port 22?

Port 22/TCP is used by the ssh service. Specific uses depend on the software and configuration. Check our related tools section for more information.

Related ports