Skip to content
Look up and open a port

Port 22: Check and securely open the SSH port

Port 22 is the default port for SSH, which provides encrypted remote administration of Linux servers. Here you’ll find key details about the port and firewall commands to allow access to it selectively.

Built by Justin Schuessler

Try the commands on your own VPS, with root access and your own firewall.

Add multiple ports one at a time, up to 12.

Or choose a preset

Ports

22/TCPSSH

Remote access · Well-known port · OSI layer 7

Encrypted remote access to the command line, plus file transfers via SFTP and SCP.

IANA: officially registered as ssh

A common target for password attacks: Sign in with an SSH key, disable password login, and use Fail2ban. If possible, allow access to this port only from your own IP.

Firewall rule (inbound)

Firewall commands

Open port

sudo ufw allow 22/tcp
Check port
Notes on ufw

For Ubuntu and Debian. ufw creates the rule for both IPv4 and IPv6. If ufw is disabled, allow SSH first (sudo ufw allow 22/tcp), then enable it with sudo ufw enable, or you'll lock yourself out.

On a ZAP-Hosting VPS with an active network firewall, you also need to allow the port in the Customer Panel.

Port 22 explained

What is port 22 used for?

Purpose

Port 22 lets you connect to your VPS or dedicated server’s command line via SSH. The entire connection is encrypted, including the login. SFTP and SCP file transfers and Git access over SSH use the same port. You can also create SSH tunnels to access other services securely without opening their ports.

Origin and standard

SSH was developed in 1995 by Tatu Ylönen at Helsinki University of Technology as a secure replacement for Telnet, rlogin and rsh. The version used today, SSH-2, is standardized in RFC 4251 through RFC 4254. The IANA lists port 22 under the name “ssh” as a well-known port. OpenSSH is the most widely used implementation.

Typical use

  • Remote administration of Linux servers via the command line
  • File transfers via SFTP and SCP
  • Git access to repositories via SSH
  • SSH tunnels and port forwarding to internal services
  • Automation with tools such as Ansible or rsync over SSH

Security

Port 22 is scanned around the clock for weak passwords. Use SSH keys and disable password login with PasswordAuthentication no in sshd_config. Allow root login only with a key, or disable it entirely. A tool like fail2ban automatically blocks IPs after multiple failed attempts. If you have a static IP, allow access to port 22 only from that IP. Moving SSH to another port only reduces log noise; key-based login is what actually improves security.

More ports

Related ports

These ports are often part of the same setup. Click one to see its explanation and firewall commands.

View all well-known ports and the complete IANA list

Port list source: IANA Service Name and Transport Protocol Port Number Registry, as of October 22, 2026. iana.org

Discover more

More tools

Subnet Calculator

Calculate the network address, broadcast address, subnet mask, and usable host range from a CIDR address, and convert between CIDR and IP ranges (IPv4 and IPv6).

Built by Jakub Martyniak

OSI model

Interactively learn the 7 layers of the OSI model: click layers, assign terms such as switch, ARP, or port 443, and explore animated encapsulation, a quiz, and a cheat sheet for the IHK exam.

Built by Justin Schuessler

TCP/IP model

Interactively learn the 4 layers of the TCP/IP model (DoD model) according to RFC 1122, with OSI model mapping, animated encapsulation, a port quiz, and a cheat sheet.

Built by Justin Schuessler

Port Checker

Check whether specific ports are open on an IP or hostname—select a protocol or game instead of scanning all ports at once.

Built by Sebastian Rademacher

Was this tool helpful?

Your feedback helps us prioritize and improve content.

FAQ

Frequently asked questions

Quick answers about port 22.

How do I open port 22 for only my IP?

With ufw, use sudo ufw allow from 203.0.113.10 to any port 22 proto tcp and replace the example IP with your own. Then delete any existing general rule for port 22. Always keep an existing SSH session open while making the change so you do not lock yourself out.

Is port 22 TCP or UDP?

SSH uses TCP. For the firewall, sudo ufw allow 22/tcp or sudo firewall-cmd --permanent --add-port=22/tcp is enough.

Should I change the SSH port?

Using a different port reduces automated login attempts in your logs but does not protect against targeted attacks. SSH keys, disabled password login, and fail2ban matter more. If you change the port, allow the new port through the firewall before restarting sshd.

What’s the difference between SSH and Telnet?

Both provide access to a remote command line. Telnet sends everything in plain text, including the password, while SSH encrypts the entire connection. You should therefore use only SSH for servers.

Still have questions?

Contact Support
Your own server?

Try the commands on your own VPS

With a ZAP-Hosting VPS, you have root access, can set up services and firewall rules yourself, and can immediately see which ports are open.

4.6/5 Google32,000+ Active serversSince 2010

No setup. No risk. Online in 60 seconds.

Flexible TermCancel anytimeOnline in 60 seconds

Looking for more tools? View all network tools

⚡ Zyber Week: 20% off rental servers and selected Lifetime servers with code ZYBER20. Grab the deal