How to change SSH port in Linux?

Chris Worner

Well-known member
Joined
Apr 15, 2016
Messages
355
Best answers
0
Ratings
35
Points
28
#1
I read many recommendations to change the port on my VPS Linux for security reason. Because if I don't change I can get a lot of brute force attack, my original port is 22. If you change to another port, then they may skip my VPS and go find for another victim or maybe they need time to find the port? How can I change ssh port in Linux?
 

sh-admin

Active member
Joined
Sep 29, 2016
Messages
66
Best answers
0
Ratings
23
Points
0
#2
In order to change the SSH port open the /etc/sshd/sshd_config file with either nano or vi command

search for "Port" option and you should see the default value of 22 there .. change it it your desire value save and exit the file ...

restart the sshd service on your server ..make sure you will open that new port for SSH in your firewall that is Iptables or CSF restart the firewall ..

now open another SSH session and try to connect the server with the new port that you have just assigned.

and it should work.
 

LJSHost

Well-known member
Joined
Jul 5, 2016
Messages
1,031
Best answers
0
Ratings
202
Points
63
#3
Even if your firewall is banning repeated brute force attempts is always a good idea to change the default port. Most port scanning is automated using default port.
This should shut down 70% of scans attempted logins.
 

Chris Worner

Well-known member
Joined
Apr 15, 2016
Messages
355
Best answers
0
Ratings
35
Points
28
#4
In order to change the SSH port open the /etc/sshd/sshd_config file with either nano or vi command

search for "Port" option and you should see the default value of 22 there .. change it it your desire value save and exit the file ...

restart the sshd service on your server ..make sure you will open that new port for SSH in your firewall that is Iptables or CSF restart the firewall ..

now open another SSH session and try to connect the server with the new port that you have just assigned.

and it should work.
Even if your firewall is banning repeated brute force attempts is always a good idea to change the default port. Most port scanning is automated using default port.
This should shut down 70% of scans attempted logins.
Thank you for sharing me tips on changing port in Linux.

Just one more question, does changing ports in Linux affect to softwares or tools work?
 

LJSHost

Well-known member
Joined
Jul 5, 2016
Messages
1,031
Best answers
0
Ratings
202
Points
63
#5
If you have software that has a connection setting for the SSH port then yes, these settings will need to be updated.
It's hard to advise further without knowing exactly what software you are running on your server.
 
Latest Threads
Replies
0
Views
1
Replies
1
Views
29
Replies
3
Views
12
Replies
3
Views
20

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top