How to change the SSH port
- Log in to your server using the current SSH port (default 22).
Note that you should not close this SSH connection until you have verified that you can access SSH on the new port number.
- Open / etc/ssh/sshd_config
vi / etc/ssh/sshd_config
- Set your Port. For example 1234
- Restart SSHD
- Configure any firewalls with the new SSH port.
- Test SSH with new port 1234
ssh USER@HOSTNAME -p1234
Use your USER and HOSTNAME and the password and confirm new port.
If the SSH test on the new port is successful you can close the connection. If it is not successful, this SSH connection should not be closed until the SSH test on the new port is successful. Else revert the port to previous state and restart.