TCPWell-Known PortFirewall: Varies
22

SSH / SFTP

What is Port 22?

Port 22 is the default port for the Secure Shell (SSH) protocol, which provides encrypted remote login, command execution, and file transfer capabilities. Developed by Tatu Ylönen in 1995 as a replacement for insecure protocols like Telnet and rlogin, SSH has become the standard for secure remote server administration. SSH version 2, defined in RFC 4253, supports public key authentication, X11 forwarding, and TCP port tunneling. SFTP (SSH File Transfer Protocol) also runs over port 22, providing encrypted file transfers as a secure alternative to FTP. Virtually every Linux and Unix server, network device, and cloud instance uses SSH for administration. It is also used for Git operations over SSH, SCP file copies, and building encrypted tunnels to protect other protocols.

Common Uses

  • Remote server administration and management
  • Secure file transfers via SFTP and SCP
  • Git repository access over SSH
  • SSH tunneling and port forwarding
  • Automated deployment scripts and CI/CD pipelines

Technical Details

Port Number22
ProtocolTCP
CategoryWell-Known
Service NameSSH / SFTP
Default FirewallVaries
Port Test Commands

Copy-paste commands to check port 22 (SSH / SFTP) from your terminal

Test connectivity

Netcat (nc)Check if TCP port is reachable
nc -zv example.com 22
curl (HTTP)Test HTTP response on this port
curl -v --max-time 5 http://example.com:22/
TelnetBasic TCP port connectivity check
telnet example.com 22
nmapScan port 22 with service detection
nmap -p 22 -sV example.com
Bash /dev/tcpPure bash TCP check (no extra tools needed)
(echo > /dev/tcp/example.com/22) 2>/dev/null && echo "open" || echo "closed"

Open port in firewall

UFW (Ubuntu / Debian)
sudo ufw allow 22/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
firewalld (RHEL / CentOS)
sudo firewall-cmd --permanent --add-port=22/tcp && sudo firewall-cmd --reload

Security Considerations

!

SSH is inherently encrypted and much safer than Telnet, but port 22 is the most commonly attacked port on the internet via brute force and credential stuffing. Harden SSH by disabling password auth in favor of key-based authentication, using fail2ban, changing the default port, and restricting access with firewall rules. Keep OpenSSH updated to patch vulnerabilities.

Popular Ports Reference

The most commonly used and referenced network ports

Related Ports