09-13-2017, 09:04 AM
Hello Folks. Last time I went to login to my VPS but I found a very weird thing, check the ping below.
So someone was brute forcing my VPS and as you can see 22082 failed login so you have to take an action and do something before accessing your VPS so I found the solution for this and that solution was Changing SSH Port and that's going to be our tutorial for today.
So firstly you have to install nano using this command
On Ubuntu
On CentOS and Fedora
Then we have to type this command to edit the SSH settings [Works for all Linux Distributions]
Then you will find
You have to uncomment it and change the port, for example it's going to be like that
Now save your changes and now we are done, last command we have to execute only to restart the SSH service.
Use this command if you are using Ubuntu
And use this command if you are using CentOS or any Redhat Distribution
Now we are done. Your connection will not be disconnected but next time you wanna to connect you have to put the port you chose in the port box (for me it was 55) like that
And if you are using Linux so you have to type
root = The VPS User
MyVPSIP = The IP of your VPS
-p = Means to use specific port
55 = Is the port I chose
The whole command means to connect to my VPS using a user called root in this IP and use specific port which it's 55.
That was our small tutorial for today, it seems too tall but it's so easy also I advise you to change the VPS port for not getting brute force or attacks on this port.
Thank you for reading my small tutorial, I hope you benefited from it and goodbye.
So someone was brute forcing my VPS and as you can see 22082 failed login so you have to take an action and do something before accessing your VPS so I found the solution for this and that solution was Changing SSH Port and that's going to be our tutorial for today.
So firstly you have to install nano using this command
On Ubuntu
Code: (Select All)
sudo apt-get install nano
On CentOS and Fedora
Code: (Select All)
sudo yum install nano
Then we have to type this command to edit the SSH settings [Works for all Linux Distributions]
Code: (Select All)
nano /etc/ssh/sshd_config
Then you will find
Code: (Select All)
#Port 22
You have to uncomment it and change the port, for example it's going to be like that
Code: (Select All)
Port 55
Now save your changes and now we are done, last command we have to execute only to restart the SSH service.
Use this command if you are using Ubuntu
Code: (Select All)
service ssh reload
And use this command if you are using CentOS or any Redhat Distribution
Code: (Select All)
sudo systemctl restart sshd
Now we are done. Your connection will not be disconnected but next time you wanna to connect you have to put the port you chose in the port box (for me it was 55) like that
And if you are using Linux so you have to type
Code: (Select All)
ssh root@MyVPSIP -p 55
MyVPSIP = The IP of your VPS
-p = Means to use specific port
55 = Is the port I chose
The whole command means to connect to my VPS using a user called root in this IP and use specific port which it's 55.
That was our small tutorial for today, it seems too tall but it's so easy also I advise you to change the VPS port for not getting brute force or attacks on this port.
Thank you for reading my small tutorial, I hope you benefited from it and goodbye.