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
Copy-paste commands to check port 22 (SSH / SFTP) from your terminal
Test connectivity
nc -zv example.com 22
curl -v --max-time 5 http://example.com:22/
telnet example.com 22
nmap -p 22 -sV example.com
(echo > /dev/tcp/example.com/22) 2>/dev/null && echo "open" || echo "closed"
Open port in firewall
sudo ufw allow 22/tcp
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
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