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
/etc/ssh/sshd_config
You can use vi
vi /etc/ssh/sshd_config
- Find this line
#Port 22
Change to your chosen port, and remove the comment ( # sign )
Port 9999
- 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
Leave a Reply