fbpx
  • Win a Fitbit Inspire HR when you move your hosting to us. Competition ends 30 November 2019

How to change the SSH port on a WHM Server

Background

It’s essential to change the default port on any Linux server to avoid dictionary and brute force attacks. The steps to change the port in WHM consists of two steps:

  1. Ensure the new port is open on the firewall
  2. Change the Port parameter in /etc/ssh/sshd_config and restart SSH

In most circumstances you want to follow this procedure in the correct order.

Ensure New Port is Open on the Firewall

For the purpose of increased security, we won’t dictate which port to use, but safe to say, choose something random, e.g. 427822.

WHM can have different firewall technologies installed, but if you’re using CSF:

Log into WHM
ConfigServer Security&Firewall
Scroll to Firewall Configuration
Search TCP_IN

Add the new port e.g. 47822 to existing allowed ports and save.

Change the Port parameter in /etc/ssh/sshd_config and restart SSH

SSH to your server
vi /etc/ssh/ssh_config
/ search for Port
Change the value from #22 or whatever it is to 47822

Restart SSH

service sshd restart

Reference

How to Change the SSH Port with WHM

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top