Change Default SSH Port Number

in #technology5 years ago (edited)


By default, SSH runs on port 22, and most scripts attack that port by brute force to attempt to gain access to your server. One way to stop script kiddies from brute forcing your SSH server so often is by changing the default port that OpenSSH uses. You must remember this port number and change all your connections that use SSH to the new port number. Remember you are doing this at your own risk!

Log into your server using SSH or the console. Navigate to the path of your SSH installation, by default its:

cd /etc/ssh/

The next thing you need to do is open the config file and actually edit it. In this example, I use nano (my favorite editor). Remember that if you only have access to SSH to connect to your server and no access to the console this may break your server if you are not careful.

nano sshd_config

You will notice a few lines down the line saying port 22 . Simply change this port number to whatever port you want, then save the file.

Next time you connect to your server, then the new port will need to be used, however, already connected sessions will still work. Although my server did not need a reboot to make the change take effect, I went ahead and did it for good measure to sever all current connections.

Credit goes to Techieshelp.com for showing me how to do this on my server!


Originally posted at https://moreabout.tech/change-default-ssh-port-number/

Sort:  

Congratulations @moreabout.tech! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 50 upvotes. Your next target is to reach 100 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 63457.41
ETH 3119.12
USDT 1.00
SBD 3.94