PORT 22 / TCPSecurity & RemoteExposure Risk: Medium
Port 22: SSH / SFTP — Secure Shell, SCP, SFTP, and Port Forwarding
Standard port for encrypted remote administration, Git over SSH, and SFTP file transfers. Harden with key-based authentication and fail2ban.
Default Service
SSH / SFTP
Process: sshd
Transport Protocol
TCP
IANA Registered Port 22
Docker Port Flag
-p 2222:22
Container to Host Mapping
How to Check & Kill Process on Port 22 (EADDRINUSE Fix)
macOS & Linux (lsof / kill)
# Find process using port 22 sudo lsof -i :22 # Instantly kill process on port 22 lsof -ti:22 | xargs kill -9
Windows (PowerShell & CMD)
# Find PID listening on port 22 netstat -ano | findstr :22 # Force kill by PID taskkill /PID <PID_NUMBER> /F
Cross-Platform Node.js One-Liner
# Kill port 22 via npx npx kill-port 22 # Or diagnose via Castov CLI npx castov fix "EADDRINUSE :::22"
Linux Firewall (UFW) & Connectivity Test
# Test if port 22 is reachable nc -zv localhost 22 # Allow or deny port 22 in UFW sudo ufw allow 22/tcp
Frequently Asked Questions about Port 22
What is Port 22 used for?
Port 22 is the standard network port for SSH / SFTP (Secure Shell, SCP, SFTP, and Port Forwarding) operating over TCP. The typical system daemon or process is sshd.
How do I kill a process running on Port 22 (EADDRINUSE)?
On macOS and Linux, run: lsof -ti:22 | xargs kill -9 (or npx kill-port 22). On Windows PowerShell/CMD, run: netstat -ano | findstr :22 and then taskkill /PID <PID> /F.
Is it safe to expose Port 22 to the internet?
Port 22 has a Medium security risk profile. Standard port for encrypted remote administration, Git over SSH, and SFTP file transfers. Harden with key-based authentication and fail2ban.