login to your server via ssh
don’t forget to update the desired port if you have firewall or ufw enabled
sudo nano /etc/ssh/sshd_config
locate line, usually #Port 22, set the port to what you want
you can remove the # symbol or create new line to insert the new port
Port 12345
save and restart sshd service
sudo systemctl restart sshd
now connect to your server using the new port