Connecting to a VPS over SSH on a custom port

Bots hit the default SSH port 22 around the clock trying to guess the root password. That is why new Linux VPS come with SSH already moved to a separate port in the 35000–35999 range, and port 22 is closed. This removes almost all password guessing and does not get in your way: you just specify the port when connecting.

Where to find the port

The port is listed in the server activation email, in the SSH connection details block (the “SSH port” line), and in your account on the service page, next to the root login details.

SSH block in the server activation email (example)

Connecting from a terminal (Linux, macOS)

Pass the port with the lowercase -p option:

ssh -p 35144 [email protected]

First connection with ssh -p: confirm the server key with yes and enter the password

If you connect without the port, ssh goes to port 22 and gets Connection refused — it means the port was not specified, not that the server is down.

Without -p — refused on port 22; with the port — logged in

Connecting from Windows

PowerShell or Command Prompt. Windows 10 and 11 already include the ssh client, and the command is the same:

ssh -p 35144 [email protected]

Connecting from Windows PowerShell

PuTTY. In the Session window: Host Name — the server IP address, Port — your SSH port (for example 35144), Connection type — SSH. To avoid typing it again, enter a name in Saved Sessions and click Save.

Files: SFTP, WinSCP, FileZilla, scp, rsync

  • WinSCP: SFTP protocol, host name — the IP address, port — your SSH port, user root.
  • FileZilla: host sftp://IP address, port — your SSH port, user root. Without “sftp://” and with port 21, FileZilla tries FTP and fails to connect.
  • scp and sftp take the port with the uppercase -P option, rsync — via -e "ssh -p port".

Copying files: scp -P and rsync -e

So you do not have to type the port every time

Add the server to the ~/.ssh/config file on your computer (on Windows — C:\Users\name\.ssh\config). After that, ssh myvps is enough, and scp, rsync, git and editors with remote work (for example VS Code) pick up the port automatically.

An entry in ~/.ssh/config and login by short name

How to change the port

The port is set in /etc/ssh/sshd_config.d/10-hosting-port.conf. First open the new port in your firewall if you enabled one (ufw, firewalld or the panel firewall), then run the commands, replacing 41022 with your port. Keep the current session open until you have checked login on the new port in another window.

nano /etc/ssh/sshd_config.d/10-hosting-port.conf      # Port 35144 -> Port 41022
sed -i "s/^port = .*/port = 41022/" /etc/fail2ban/jail.d/00-hosting-sshd.local
sshd -t
if systemctl is-enabled --quiet ssh.socket 2>/dev/null; then systemctl daemon-reload; systemctl restart ssh.socket
else systemctl restart ssh 2>/dev/null || systemctl restart sshd; fi
systemctl restart fail2ban
ss -ltn | grep 41022

The port file and a check that SSH listens on it

The second command moves the fail2ban password-guessing protection to the new port. You can return to the default port the same way — set Port 22 — but password guessing will come back.

If you lost access

Open the server VNC console in your account, log in as root and check the 10-hosting-port.conf file and the output of ss -ltn. If that does not help, write to us in a ticket.

Questions and answers
Bots constantly guess passwords on port 22. A separate port removes almost all of that traffic and lowers the risk of the server being hacked.
In your account on the VPS service page, next to the root login details.
Enter the host as sftp://IP address and use the SSH port. Port 21 is plain FTP, while root can only log in over SFTP.
No. The SSH port is only for SSH and SFTP. The control panel opens at its own address from the email.

Choose language