Port 22 — SSH (TCP)
What is Port 22?
시큐어 셸 로그인
This is a well-known port (0–1023) commonly used by core services like SSH. · RFC 4251, RFC 4252, RFC 4253, RFC 4254
When do you need Port 22 open?
Open if you need remote terminal access, SCP/SFTP file transfers, or Git over SSH to this machine. Keep closed on desktop workstations with no remote administration needs. Restrict access to known IP ranges where possible.
Common uses and software
- OpenSSH
- Dropbear
- Bitvise SSH Server
- PuTTY (client)
- Git over SSH
- VS Code Remote SSH
보안
Port 22 is one of the most heavily scanned ports on the internet, targeted by automated brute-force bots. Disable password authentication and require SSH key pairs (Ed25519 recommended). Restrict access to known IP ranges in your firewall. Consider moving SSH to a non-standard port (e.g., 2222) to reduce automated scan noise — this reduces log spam but is not a security substitute for key-based auth.
Is Port 22 safe?
An open port increases your attack surface. Safety depends on how SSH is configured.
Keep SSH up to date with security patches. Require strong authentication and restrict access to the minimum necessary IP addresses.
Test connectivity for Port 22 on any host.
How to Open Port 22
To allow incoming connections to Port 22 (SSH) from outside your network, configure your firewall and add a port forwarding rule on your router pointing to your device's local IP address.
Open Windows Defender Firewall → Advanced Settings → Inbound Rules → New Rule → Port → TCP → Specific local ports: 22 → Allow the connection → Name and save the rule.
netsh advfirewall firewall add rule name="Open Port 22" dir=in action=allow protocol=tcp localport=22sudo ufw allow 22/tcpsudo iptables -A INPUT -p tcp --dport 22 -j ACCEPTLog into your router (192.168.1.1 or 192.168.0.1) → Port Forwarding → Add a new rule: Protocol TCP, External port 22, Internal IP: your device's local IP, Internal port 22 → Save.
How to close Port 22
If you do not need SSH, block this port in your firewall or router.
To block port 22 on Windows, run the following command in PowerShell or Command Prompt (as Administrator):
netsh advfirewall firewall add rule name="Block Port 22" dir=in action=block protocol=tcp localport=22sudo ufw deny 22/tcpsudo iptables -A INPUT -p tcp --dport 22 -j DROPRemove or disable any port forwarding rule for Port 22.
Frequently Asked Questions
What is Port 22 used for?▾
Port 22 is the default TCP port for SSH. It is used by servers and applications that need to accept incoming connections for this service. Whether you need it open depends on whether you are actively running a SSH server — if not, it should remain closed to reduce your attack surface.
Is Port 22 safe to keep open?▾
An open Port 22 increases your attack surface. If you are not actively running SSH, close this port in your firewall and remove any port forwarding rules. If SSH must be accessible, restrict access to known IP ranges, keep the service software updated with security patches, and use strong authentication.