In some cases, you need to change the SSH port, create and use an SSH key. In this article, AZDIGI will show you how to change the default SSH port and create an SSH key to SSH into the VPS without SSH using a root user.
Why should I change the default SSH port and use SSH Key on VPS?
On VPS, the default SSH port will be port 22, this port will help users access the VPS in the easiest way to remember. y risks because many bad people will take advantage of this default SSH port configuration to perform brute-force attacks on the VPS’s root account. So we need to change the default SSH port to another port for more security.
How to change SSH port, create SSH key
1. Change SSH port
First, you access CyberPanel by following the link: https://IP:8090. For example, https://188.8.131.52:8090/
After successful login, you can access =>SECURITY => SECURE SSH
You will see the interface as shown below:
- SSH port: port SSH
- Permit Root Login: Enabled or Disabled login as root (if to disable in this section, you need to make sure that there is another user who has SSH access to the VPS other than user: root to still be able to Let’s SSH)
In the Basic tab, to change the port, enter the port you need to change in the SSH Port box (1) => Here I enter port 2106 => Save changes (2)
The process will take a few minutes, and if you receive a message like this, it is successful.
You can access SSH with the new port to test it. As shown below, I have successfully SSHed with the new port.
2. SSH key
In the SSH Keys tab, if you don’t want to SSH into the server as root but want to use SSH Key
You can add SSH keys by => Add Key and paste the Key in (1) => Save (2)
After adding the key, you can access SSH to check.
Thus, in this article, AZDIGI has shown you how to change SSH ports, create SSH keys directly at the CyberPanel interface in the simplest way without having to SSH into the server, using the above features is recommended. use and will help you a lot in improving security as well as limiting the risk of attacks from hackers and bad guys.
Wishing you success!