Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

What Is SSH Port 22?

Learn what a port is, why SSH uses port 22, and how to connect when your server uses a different one.

Files and FTP2 min read7 steps

What is a port?

A server can do many jobs at once. It can show websites, send email and accept logins. Each job listens at its own numbered door. That door is called a port. Think of a big building with many numbered doors.

What is port 22?

SSH stands for Secure Shell. It is a safe way to type commands on a remote server. By default, SSH listens on port 22. Programs that use SSH, such as SFTP (secure file transfer), also use port 22.

Because everyone knows this number, bad bots often knock on it. They try many passwords. That is why some people change the port.

How to connect on port 22

You do not need to type the port. SSH uses 22 on its own.

ssh username@your-server-address

This connects to your server on the default port.

How to connect on another port

Add -p and the number.

ssh -p 2222 username@your-server-address

This connects using port 2222. Your welcome email or Hostvento support can tell you which port your service uses.

How to change the SSH port (root access needed)

This part is for VPS and dedicated server owners. It needs root access. Root is the all-powerful admin user.

Warning: A wrong change can lock you out. Keep your current SSH window open until you have tested the new port. Also open the new port in your firewall first.

  1. Log in as root with SSH.
  2. Open the SSH settings file.
    nano /etc/ssh/sshd_config
    This opens the file in a simple editor.
  3. Find the line that starts with #Port 22.
  4. Change it to your new number and remove the #. For example, Port 2222.
  5. Save with Ctrl + O, press Enter, then exit with Ctrl + X.
  6. Restart the SSH service.
    systemctl restart sshd
    This applies the new setting.
  7. Open a second window and test the new port before you close the first one.
Tip: Pick a number between 1024 and 65535 that no other service uses. Changing the port only hides the door. Strong passwords or SSH keys still matter most.

Quick recap

  • A port is a numbered door on a server.
  • SSH uses port 22 by default.
  • Use -p to connect to a different port.
  • Changing the port needs root access and care.
  • Test the new port before closing your old session.