Problems activating your account? Send notification email to: admin@post4vps.com
Host4Fun Budget VPS Hosting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change Port 22 on CentoS 7
#1
Step 1  Choose a random number between 49152 and 65535

Step 2  SSH into your VPS - if you don't have NANO already loaded with CentoS - you can do it with this command:

yum install nano

Step 3 Use this command to edit the port number

nano /etc/ssh/sshd_config

With nano you'll be able to scroll with your up and down keys to:

#Server 22

Delete # and replace 22 with your random number.  Remember to make a note of the new number.


Step 4 Save the change with 'ctrl o'  and exit with 'ctrl exit'
ctrl exit

Step 5
service sshd restart



For me personally VestaCP wouldn't work after the change of Port 22.  I tried all kinds of recommendations, but in the end it was better to reinstall VestaCP.  I also reinstalled my OS as I was planning to experiment with security measures for a while before I loaded the Websites back on. 


Feedback:  After the change of the port number I had no more bad login attempts.  This really works well.
[Image: 4ax8Kok.png]
Thank you to the Owner & Staff of Post4VPS and VirMach for an awesome VPS 9 experience!




Reply
#2
That will not help to prevent an hacker
You must change the root user as well
My condition is not good
I Request a Holiday to Relax !
Reply
#3
(07-01-2018, 01:38 AM)chanalku91 Wrote:  That will not help to prevent an hacker
You must change the root user as well
I have taken other precautions as well - but the port number is probably one of the simplest changes to make and people who gave me advice here were 100% correct - there wasn't a single bad login after I had changed only the port number.   After I changed the port number I went one step further and disabled password authentication for the VPS as well. 

If someone really wanted to hack they probably will and can but for what I'm using the VPS for I feel I'm OK for now.
[Image: 4ax8Kok.png]
Thank you to the Owner & Staff of Post4VPS and VirMach for an awesome VPS 9 experience!




Reply
#4
(07-01-2018, 01:38 AM)chanalku91 Wrote:  That will not help to prevent an hacker

It isn't meant and it wasn't designed to prevent human hackers from trying to access your server without authorization. In fact changing the SSH port and believing that it stops real hackers is something that the more seasoned server operaters call "security through obscurity" or simply: it doesn't add any security layer but sounds like it would.

So what is it good for? We discussed this already in the main topic by deanhills regarding the issues behind this tutorial. Changing the SSH port will stop 100% of all automated bot bruteforce attacks carried out by infected computers, servers, IoT devices, routers and etc. It works very well for this purpose because these kind of bruteforce attacks only target the default service port such as 22 for SSH in this case.
Reply
#5
In my case, I was able to stop attempts of hackers by changing the default port, I think those attempts were made by bots, especially by Chinese proxies.
Reply
#6
(07-01-2018, 04:21 PM)Littlemaster Wrote:  In my case, I was able to stop attempts of hackers by changing the default port, I think those attempts were made by bots, especially by Chinese proxies.

Same here, i got 46831 failed attempts before. But now there is no attempts
Gimme +rep Heart
[Image: img.php?userid=496]
Thanks For Post4VPS and VPSlices for the amazing VPS 4
Reply
#7
(07-01-2018, 01:32 AM)deanhills Wrote:  Step 1  Choose a random number between 49152 and 65535

......


Well, actually you do not have to limit only to this range of dynamic ports.

User ports (range from 1024 to 49151) can also be used for ssh access purpose.
Special thanks to VPSVortex for a great KVM VPS.

Reply
#8
Take note if your using a firewall to block all unused port, don't forget to adjust your firewall settings before anything else you might can't connect if you forgot to update it.
Reply
#9
Thanks for sharing the tutorial.I was thinking to move to Centos from Ubuntu.Then i thought it will be different and i am totally new to Linux.But this tutorial helped me and Now i am feeling that mos of the Commands of Linux are same.
Reply
 


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to upgrade php from 5.6 to 7.0 in VestaCP with CentOS 7.0 deanhills 0 175 08-02-2018, 11:23 PM
Last Post: deanhills
  Installing TS3 Server on VPS [ Centos/Ubuntu/Debian ] HarisHayat 2 297 05-15-2018, 08:07 AM
Last Post: HarisHayat
Lightbulb How to install Open Game Panel (Latest Panel) on Centos 6/7 Zorono 7 1,683 05-10-2018, 12:32 PM
Last Post: YOuNeS_Dz
  How to install VestaCP - Centos 6-7 Zorono 22 4,259 02-28-2018, 05:32 PM
Last Post: kabir145
  How to Install sa-mp server on VPS (Centos/Debain/Ubuntu) Zorono 8 2,317 10-25-2017, 09:28 PM
Last Post: YOuNeS_Dz

Forum Jump:


Users browsing this thread: 1 Guest(s)

Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - SSDBlaze - VPSlices - Abc-Hosters - Hyper Expert


About Post4VPS

Post4VPS is a forum/destiny where you can Delploy Your Free VPSs just by the Power of Posts.

We Provide VPSs of many locations like Germany,US,Canada,France,London,etc.

We also Provide VPSs of Both Linux and Windows OS.