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:
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.
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!