Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

How to run SSH on a different port

Mike Peters, 12-21-2009
By default SSH runs on port 22. One of the easiest ways to make it more difficult for hackers to run dictionary attacks on your server, attempting to brute-force ssh-login, is to run ssh on a different port.

Open up /etc/ssh/sshd_config and add this line at the top:

Port 1234

Replace 1234 with the port number you'd like to run ssh on. If there is already a Port line in your sshd_config file, comment it with a #

Now, Restart sshd by issuing:

/etc/rc.d/init.d/sshd restart

Test ssh works properly by connecting locally (replace 1234 with the new port number):

ssh -l USERNAME localhost -p 1234

Mike Peters, 12-31-2009
If you're using rsync and you switched ssh to a different port, you're going to have to pass one extra parameter to rsync:

--rsh='ssh -p44444'

Where 44444 is the new port number
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions