TCP · Port 22IANA Registered

Port 22 — SSH (Secure Shell)

Encrypted remote administration protocol for secure CLI logins, remote command execution, and encrypted file transfers via SFTP/SCP.

⚡ Primary Use Cases & Environments

  • ✓Linux/UNIX server administration
  • ✓Git push/pull over SSH
  • ✓Encrypted SFTP transfers
  • ✓SSH port forwarding tunnels

🛡️ Security & Vulnerability Analysis

A primary target for automated internet brute-force attacks. Disable password authentication in favor of Ed25519 SSH keys, disable root login (PermitRootLogin no), and install fail2ban.

🔧 Network Diagnostics & Inspection

1. Check Active Listening Sockets (Local Host)
Terminal Command
$ sudo ss -tuln | grep :22
Inspects whether any local process daemon is bound to port 22.
2. Remote Port & Service Scan (Nmap)
Terminal Command
$ nmap -p 22 -sV -sC <target-ip>
Probes target IP to determine whether port 22 is open, closed, or filtered.
3. Wireshark Capture / Display Filter
tcp.port == 22Wireshark Filter

🔥 Firewall Configuration Rules (UFW & iptables)

UFW (Uncomplicated Firewall)
Terminal Command
$ sudo ufw allow 22/tcp
Applies a persistent Linux UFW firewall rule for port 22.
iptables Command
Terminal Command
$ sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Appends a direct netfilter kernel rule to the INPUT chain for port 22.

❓ Frequently Asked Questions (FAQ)

Should I change the default SSH port 22?

Changing to a non-standard port (e.g. 2222) reduces automated scanner noise in auth logs by ~90%, but does not replace key-based authentication and fail2ban.

How do I check who is connected to port 22?

Run "who" or "w" to see logged-in users, or run "sudo ss -tnp | grep :22" to see all active incoming SSH TCP connections.

Related Networking Tools & Guides