At least in the default Ubuntu + OpenSSH implementation, sshd.service
and ssh.service
are in fact not different units - the former is an alias for the latter, defined in the [Install]
section of its unit file, /lib/systemd/system/ssh.service
:
[Install]
WantedBy=multi-user.target
Alias=sshd.service
Such aliases are discussed in the DESCRIPTION
section of man systemd.unit
, and essentially work by creating symbolic links - in this case,
$ ls -l /etc/systemd/system/sshd.service
lrwxrwxrwx 1 root root 31 Feb 16 2022 /etc/systemd/system/sshd.service -> /lib/systemd/system/ssh.service
allowing you to start / stop / query the status of the service via systemctl
using either ssh.service
, or sshd.service
(or even just ssh
or sshd
).
So what you are observing is that journalctl
apparently doesn't resolve these systemd aliases - there's some discussion of why and whether it should in Issue #11846: Journalctl working with Systemd Alias (in Install section) and also a related (but not satisfactorily answered) question on our sibling site, How to use systemd aliases with journalctl?