socket activation
systemd holds the listening port itself and starts the service only on the first connection. On Ubuntu 24.04 openssh-server works this way: ssh.socket owns port 22, a generator reads that port out of /etc/ssh/sshd_config, and ssh.service starts when somebody connects. Hence systemctl is-enabled ssh.service ssh.socket printing disabled then enabled — SSH is perfectly fine: the service is deliberately not enabled because the socket is. Two mistakes follow from misreading it. systemctl restart ssh fills in .service and never touches what listens on 22, so the listening socket you meant to reset is untouched. And stopping or disabling ssh.socket on a remote machine closes the port: your current session survives, new connections are refused, including your own as soon as you hang up.
Also written: socket-activated, .socket unit
