
If you are using WHM & CSF, under CentOS, you may follow this steps to change SSH port from 22 (default) to something else .
1.First we must allow incoming data in the new port. Open your WHM >> Plugins >> CSF.
2. Click “Firewall Configuration” button.
3. Add your new port in “TCP_IN” and “TCP_OUT”.
4. Click “Change” button in the bottom of the page.
5. You will be asked to restart CSF & LFD. Do it.
6. Next, edit this file
/etc/ssh/sshd_config
- You can use vi
vi /etc/ssh/sshd_config
7. Find this line
#Port 22
Change to your chosen port, and remove the comment ( # sign )
Port 9999
8. Restart the SSH service from WHM : Restart Services > SSH Server (OpenSSH), or with this command :
service sshd reload
9. It’s done
10. Optional steps : remove port 22 from CSF > Firewall Configuration > TCP_IN & TCP_OUT
- Source : xrvel