Normally we can login to the server using the command
ssh myuser@123.456.789.12
The default port in ssh is 22
Let's change it to 1234
Inside the folder
sudo nano /etc/ssh/sshd_config.d/change-port-ssh.conf
## content
Port 1234
sudo systemctl edit ssh.socket
/etc/systemd/system/ssh.socket.d/override.conf ← your changes
/usr/lib/systemd/system/ssh.socket ← untouched, safe to update
[Socket]
ListenStream=
ListenStream=*****:1234 <----- the same as in command below ( with status )
ListenStream=[::]:1234 <----- the same as in command below (with status )
Reload the ssh and socket
sudo systemctl daemon-reload
sudo systemctl restart ssh.socket ssh
Let's check if that changed properly
sudo ss -tlnp | grep ssh
##output
LISTEN 0 **** *****:1234
LISTEN 0 **** [::]:1234
Attention!!!
Don't logout until you are not sure that everything is working properly. In that case you can logout yourself and can not login to the sever with default port.
Let's login
ssh myuser@123.456.789.1 -p 1234
When we need to update CI/CD workflows we need to
ssh → -p 1234 (lowercase)
scp → -P 1234 (uppercase)
rsync → -e "ssh -p 1234"