To change the SSH port, follow these steps:
1. Open the SSH configuration file on your server. By default, this is the '/etc/ssh/sshd_config' file
nano /etc/ssh/sshd_config
2. find the line starting with 'Port' and modify it to match the new port number you want to set. Example: 'Port 22' change to 'Port 2222'
Port 22
3. Save the updated configuration `CTRL+X` and then `Y and enter`.
4. restart the SSH service to apply the changes
service ssh restart
Your port has been changed to your preferred port.