Networking
Risk: Critical

Port 22 β€” SSH (Secure Shell) & SFTP

Port 22 is the standard port used for Secure Shell (SSH) remote command execution, secure file transfer (SFTP), and Git over SSH (`git@github.com`).

PORT NUMBER

22

PROTOCOL

TCP

DEFAULT PROCESS

sshd

FIREWALL TARGET

22/tcp

Instant Terminal Fixes for Port 22

macOS & Linux Terminal
1. Check who is listening on port 22:
sudo ss -tulpn | grep :22
2. Kill process occupying port 22 (EADDRINUSE fix):
sudo systemctl restart sshd
3. UFW Firewall Allow rule:
sudo ufw allow 22/tcp
Windows PowerShell (Admin)
1. Check listening port:
Get-NetTCPConnection -LocalPort 22
2. Force kill process on port 22:
Stop-Service sshd -Force
3. Docker Port Forwarding Mapping:
docker run -p 2222:22 -d my-ssh-server

Common Error Encountered

ssh: connect to host example.com port 22: Connection refused / Connection timed out

Security Advisory & Hardening

Public port 22 is under constant brute-force dictionary attack. Disable password authentication (`PasswordAuthentication no`), disable root login (`PermitRootLogin no`), and install Fail2ban.

Frequently Asked Questions

Port 22 Questions & Answers

Common questions regarding default services, kill commands, and firewall configurations.

Port 22 is commonly used for SSH (Secure Shell) & SFTP. Port 22 is the standard port used for Secure Shell (SSH) remote command execution, secure file transfer (SFTP), and Git over SSH (`git@github.com`).