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:
- Ensure the new port is open on the firewall
- 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:
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
/ search for
Change the value from
#22 or whatever it is to
service sshd restart