To secure your Linux server from automated attacks, we recommend changing the SSH port. Here we explain several ways how you can change the SSH port of your server.
Automatisiert über das Webinterface

- Open the Cloud Manager of the server where you want to change the SSH port.
- Click on VPS settings
- Open the tab „SSH„.
- Enter the desired SSH port in the input field „Change SSH port„. Make sure to use a free port above 1024.
- Then click „Save„.
- The configuration will be adjusted in the background and your SSH server will be restarted.
Important: If you use a software firewall (iptables, ufw, firewalld), you have to release the port before. If you forgot to do this, you can easily fix it via VNC.
Edit the configuration manually
Of course, you can also edit the configuration of the SSH server manually. We will show you how to do it.
- Connect to your Linux server via SSH.
- Open the file /etc/ssh/sshd_config with „nano“ for example.
- Find the line that contains „port“. If it does not exist, put it quite high up. Make sure that the line does not start with „#„. Remove the „#“ if this is the case.
- Now write after „Port“ the number you want to use as port for the SSH server. For example port 2222.
- Save the file.
- Check with the command „ssh -T“ if the configuration can be read successfully.
- Restart the SSH server (service ssh restart), but do not close the SSH window yet.
- Open a new SSH window and test the connection. If something does not work, you can still use the open connection to solve the problem.