If a computer is going to be accessible from outside an internal LAN, the computer must be secure from hackers. Changing the Default port that SSH runs on won’t necessarily prevent a determined hacker from gaining access, but it will stop the majority of automated bots and scripts that will try to gain access. If you need to have access to a system while out and about, SSH can be useful. It can be used to grab files from the computer, and to backup files to the computer from a remote location. While at school I can backup all of my projects to my computer using SSH instead of having to use Dropbox or Google Drive.
First enable SSH from the sharing tab under system preferences. It is the option called Remote Login.
By default SSH will run on port 22. To change this on Mavericks or Mountain Lion you just have to run this script. It will let you choose what port you want it to run on. I did not make this script and I do not claim any credit for making it. I just found that it worked well and decided to make a little guide on how to use it.
Run the following command ignoring the quotation marks. This will download the script from the developers site and run it.
“bash <(curl -Ls http://git.io/_9fF7g)”
It will ask you which port you want to run SSH on, I would recommend anything above 1000. It will ask you to enter an administrators password, once you enter it, the port will be changed. To reset the port to 22, just enter 22 as the port to set it to using the same script. If you have any questions just leave a comment here, and if this helped you, remember to keep checking back for more helpful posts.