# sudo apt-get update
# sudo apt-get install openssh-server
See status:
# sudo systemctl status ssh
Backup the ssh configuration:
# sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup
configure the ssh server:
# sudo nano /etc/ssh/sshd_config
Warning On ubuntu 22.10 SSHd now uses socket-based activation.
On upgrades from Ubuntu 22.04 LTS, users who had configured Port settings or a ListenAddress setting in /etc/ssh/sshd_config will find these settings migrated to /etc/systemd/system/ssh.socket.d/addresses.conf. As an exception, if more than one ListenAddress setting is declared, the configuration is not migrated because systemd’s ListenStream has different semantics: any address configured which is not present at boot time would cause the ssh.socket unit to not start.
So to change ssh port:
# sudo sudo nano /lib/systemd/system/ssh.socket
#Change the following parameter to the port of your choice e.g. 44022
ListenStream=44022
#save the file and quit nano editor.
# sudo systemctl daemon-reload
# sudo systemctl restart ssh
# sudo netstat -tulpn
see: