How do I restart sshd on raspbian stretch?
This does not work:
pi@raspberrypi:~/.ssh $ sudo systemctl restart sshd Failed to restart sshd.service: Unit sshd.service not found.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
As stated in the comments the main service is
ssh.service. But you can it also address with
sshd.service. As you can see
ssh.service has an Alias:
pi ~$ systemctl cat ssh # /lib/systemd/system/ssh.service [..] [Install] WantedBy=multi-user.target Alias=sshd.service pi ~$
In addition, unit files may specify aliases through the Alias= directive in the [Install] section; those aliases are only effective when the unit is enabled.
pi ~$ sudo systemctl enable ssh
You can also get it with:
pi ~$ systemctl status sshd