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